Demo entry 6758304

pytest example

   

Submitted by anonymous on Aug 10, 2018 at 14:46
Language: Python 3. Code size: 491 Bytes.

def hottest_summer(df) -> int:

    df['summer_max'] = df[['JUN', 'JUL', 'AUG']].max(axis=1)

    hottest_year = df['summer_max'].idxmax()

    return hottest_year



@given(

    data_frames(

        columns=columns(

            ['JUN', 'JUL', 'AUG'],

            elements=st.floats(allow_nan=True)

        ),

        index=range_indexes(min_size=1)

    )

)

def test_hottest_summer_auto(df):

    assert not pd.isnull(hottest_summer(df))

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).