Skip to content

Commit 9c24fec

Browse files
committed
TST: Add tests for filter method
1 parent 003c6ac commit 9c24fec

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

pandas/tests/frame/test_axis_select_reindex.py

+21
Original file line numberDiff line numberDiff line change
@@ -884,6 +884,27 @@ 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('name,expected', [
888+
('a', DataFrame({u'a': [1, 2]})),
889+
(u'a', DataFrame({u'a': [1, 2]})),
890+
(u'あ', DataFrame({u'あ': [3, 4]}))
891+
])
892+
def test_filter_unicode(self, name, expected):
893+
# GH13101
894+
df = DataFrame({u'a': [1, 2], u'あ': [3, 4]})
895+
896+
assert_frame_equal(df.filter(like=name), expected)
897+
assert_frame_equal(df.filter(regex=name), expected)
898+
899+
@pytest.mark.parametrize('name', ['a', u'a'])
900+
def test_filter_bytestring(self, name):
901+
# GH13101
902+
df = DataFrame({b'a': [1, 2], b'b': [3, 4]})
903+
expected = DataFrame({b'a': [1, 2]})
904+
905+
assert_frame_equal(df.filter(like=name), expected)
906+
assert_frame_equal(df.filter(regex=name), expected)
907+
887908
def test_filter_corner(self):
888909
empty = DataFrame()
889910

0 commit comments

Comments
 (0)