Ejemplo n.º 1
0
 def test_string_matching(self, example_df):
     """unix style matching should also work."""
     # test *
     out = filter_df(example_df, first_name="J*")
     assert {"Jason", "Jake"} == set(example_df[out].first_name)
     # test ???
     out = filter_df(example_df, first_name="J???")
     assert {"Jake"} == set(example_df[out].first_name)
Ejemplo n.º 2
0
 def test_bad_parameter_raises(self, example_df):
     """ensure passing a parameter that doesn't have a column raises."""
     with pytest.raises(ValueError):
         filter_df(example_df, bad_column=2)
Ejemplo n.º 3
0
 def test_non_str_sequence(self, example_df):
     """ensure sequences still work for isin style comparisons."""
     out = filter_df(example_df, age={42, 52})
     assert out[:2].all()
     assert not out[2:].any()
Ejemplo n.º 4
0
 def test_non_str_single_arg(self, example_df):
     """test that filter index can be used on Non-nslc columns."""
     # test non strings
     out = filter_df(example_df, age=42)
     assert out[0]
     assert not out[1:].any()
Ejemplo n.º 5
0
 def test_str_sequence(self, example_df):
     """Test str sequences find values in sequence."""
     out = filter_df(example_df, last_name={"Miller", "Jacobson"})
     assert out[:2].all()
     assert not out[2:].any()
Ejemplo n.º 6
0
 def test_string_basic(self, example_df):
     """test that specifying a string with no matching works."""
     out = filter_df(example_df, first_name="Jason")
     assert out[0]
     assert not out[1:].any()