Skip to content

Commit 2771e37

Browse files
committed
Tests added to the right part of the code (class TestIsin)
1 parent 47e5962 commit 2771e37

File tree

2 files changed

+27
-13
lines changed

2 files changed

+27
-13
lines changed

pandas/tests/frame/methods/test_isin.py

-13
Original file line numberDiff line numberDiff line change
@@ -189,16 +189,3 @@ def test_isin_empty_datetimelike(self):
189189
tm.assert_frame_equal(result, expected)
190190
result = df1_td.isin(df3)
191191
tm.assert_frame_equal(result, expected)
192-
193-
def test_isin_int_df_string_search(self):
194-
"""Comparing df with int`s (1,2) with a string at isin() ("1")
195-
-> should not match values because int 1 is not equal str 1"""
196-
df = DataFrame({"values": [1, 2]})
197-
result = df.isin(["1"])
198-
expected_false = pd.DataFrame({"values": [False, False]})
199-
tm.assert_frame_equal(result, expected_false)
200-
201-
# Comparing df with int`s with a int at isin() -> should be fine
202-
result = df.isin([1])
203-
expected_true = DataFrame({"values": [True, False]})
204-
tm.assert_frame_equal(result, expected_true)

pandas/tests/test_algos.py

+27
Original file line numberDiff line numberDiff line change
@@ -2374,3 +2374,30 @@ def test_index(self):
23742374
dtype="timedelta64[ns]",
23752375
)
23762376
tm.assert_series_equal(algos.mode(idx), exp)
2377+
2378+
@pytest.mark.xfail(reason="problem related with issue #34125")
2379+
def test_isin_int_df_string_search(self):
2380+
"""Comparing df with int`s (1,2) with a string at isin() ("1")
2381+
-> should not match values because int 1 is not equal str 1"""
2382+
df = pd.DataFrame({"values": [1, 2]})
2383+
result = df.isin(["1"])
2384+
expected_false = pd.DataFrame({"values": [False, False]})
2385+
tm.assert_frame_equal(result, expected_false)
2386+
2387+
@pytest.mark.xfail(reason="problem related with issue #34125")
2388+
def test_isin_nan_df_string_search(self):
2389+
"""Comparing df with nan value (np.nan,2) with a string at isin() ("NaN")
2390+
-> should not match values because np.nan is not equal str NaN """
2391+
df = DataFrame({"values": [np.nan, 2]})
2392+
result = df.isin(["NaN"])
2393+
expected_false = pd.DataFrame({"values": [False, False]})
2394+
tm.assert_frame_equal(result, expected_false)
2395+
2396+
@pytest.mark.xfail(reason="problem related with issue #34125")
2397+
def test_isin_float_df_string_search(self):
2398+
"""Comparing df with floats (1.4245,2.32441) with a string at isin() ("1.4245")
2399+
-> should not match values because float 1.4245 is not equal str 1.4245"""
2400+
df = DataFrame({"values": [1.4245, 2.32441]})
2401+
result = df.isin(["1.4245"])
2402+
expected_false = pd.DataFrame({"values": [False, False]})
2403+
tm.assert_frame_equal(result, expected_false)

0 commit comments

Comments
 (0)