Skip to content

Commit fd8d1d5

Browse files
committed
TST: Add tests for filter method
1 parent e55bf8e commit fd8d1d5

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

pandas/tests/frame/test_axis_select_reindex.py

+16
Original file line numberDiff line numberDiff line change
@@ -884,6 +884,22 @@ def test_filter_regex_search(self):
884884
exp = df[[x for x in df.columns if 'BB' in x]]
885885
assert_frame_equal(result, exp)
886886

887+
@pytest.mark.parametrize('exp', ['a', u'a'])
888+
def test_filter_unicode(self, exp):
889+
df = DataFrame({u'a': [1, 2], u'b': [3, 4]})
890+
expected = DataFrame({u'a': [1, 2]})
891+
892+
assert_frame_equal(df.filter(like=exp), expected)
893+
assert_frame_equal(df.filter(regex=exp), expected)
894+
895+
@pytest.mark.parametrize('exp', ['a', u'a'])
896+
def test_filter_bytestring(self, exp):
897+
df = DataFrame({b'a': [1, 2], b'b': [3, 4]})
898+
expected = DataFrame({b'a': [1, 2]})
899+
900+
assert_frame_equal(df.filter(like=exp), expected)
901+
assert_frame_equal(df.filter(regex=exp), expected)
902+
887903
def test_filter_corner(self):
888904
empty = DataFrame()
889905

0 commit comments

Comments
 (0)