Skip to content

Commit

Permalink
test: test the right function
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobdadams committed Jul 31, 2023
1 parent fbac445 commit 83022af
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions tests/test_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,18 +442,6 @@ def test_switch_to_nullable_int_casts_string_field_with_empty_string(self):

tm.assert_frame_equal(retyped_df, test_df)

def test_switch_to_nullable_int_raises_on_uncastable_text(self):
df = pd.DataFrame({
'a': [1, 2, np.nan],
'b': [1.1, 1.2, 'foo'],
})

with pytest.raises(
TypeError,
match=re.escape('Cannot convert one or more fields to nullable ints. Check for non-int/non-np.nan values.')
):
retyped_df = palletjack.transform.DataCleaning.switch_to_nullable_int(df, ['a', 'b'])


class TestFloatFixing:

Expand Down Expand Up @@ -512,6 +500,18 @@ def test_switch_to_float_comma_thousands_separator_mixed_input_types(self):

tm.assert_frame_equal(retyped_df, test_df)

def test_switch_to_float_raises_on_uncastable_text(self):
df = pd.DataFrame({
'a': [1, 2, np.nan],
'b': [1.1, 1.2, 'foo'],
})

with pytest.raises(
TypeError,
match=re.escape('Cannot convert one or more fields to floats. Check for non-float/non-null values.')
):
retyped_df = palletjack.transform.DataCleaning.switch_to_float(df, ['a', 'b'])


class TestSwitchSeriesToNumericDtype:

Expand Down

0 comments on commit 83022af

Please sign in to comment.