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)
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)
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()
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()
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()
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()