Skip to content

Commit

Permalink
add test for single condition
Browse files Browse the repository at this point in the history
  • Loading branch information
samukweku committed Oct 18, 2023
1 parent cff8030 commit cf6d1d1
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pandas/tests/test_case_when.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ def test_case_when_raise_error_from_mask(df):
case_when(df["a"].eq(1), df)


def test_case_when_single_condition(df):
"""
Test output on a single condition.
"""
result = case_when(df.a.eq(1), 1)
expected = Series([1, np.nan, np.nan])
tm.assert_series_equal(result, expected)


def test_case_when_multiple_conditions(df):
"""
Test output when booleans are derived from a computation
Expand Down

0 comments on commit cf6d1d1

Please sign in to comment.