def test_filter_from_repr_unexpected_filter_name(): unexpected_filter_name = 'unexpectedFilterName' data = {unexpected_filter_name: 'DoesNotMatter'} with pytest.raises(ValueError) as ex_info: Filter.from_repr(data) assert unexpected_filter_name in ex_info.value.args[0]
def test_filter_from_repr(composite_filter): original_filter = Filter(inner_filter=composite_filter) data = {'compositeFilter': original_filter.inner_filter.to_repr()} output_filter = Filter.from_repr(data) assert output_filter == original_filter