From e93a0e9a58f694256c5ece50d6e02071162772fa Mon Sep 17 00:00:00 2001 From: Matthew Evans Date: Tue, 6 Dec 2022 23:03:26 +0000 Subject: [PATCH] Add test cases for fuzzy list comparison in grammar --- tests/filterparser/test_filterparser.py | 43 +++++++++++++------------ 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/tests/filterparser/test_filterparser.py b/tests/filterparser/test_filterparser.py index 5296bf797..d63959c06 100644 --- a/tests/filterparser/test_filterparser.py +++ b/tests/filterparser/test_filterparser.py @@ -272,23 +272,26 @@ class TestParserV1_2_0(TestParserV1_0_0): version = (1, 2, 0) variant = "develop" - def test_boolean_values(self): - assert isinstance( - self.parse("_exmpl_element_counts = TRUE"), - Tree, - ) - - assert isinstance( - self.parse("_exmpl_element_counts = FALSE"), - Tree, - ) - - assert isinstance( - self.parse("_exmpl_element_counts != FALSE"), - Tree, - ) - - assert isinstance( - self.parse("NOT _exmpl_element_counts = TRUE"), - Tree, - ) + @pytest.mark.parametrize( + "case", + [ + "_exmpl_element_counts = TRUE", + "_exmpl_element_counts = FALSE", + "_exmpl_element_counts != FALSE", + "_exmpl_element_counts != FALSE", + "NOT _exmpl_element_counts = TRUE", + ], + ) + def test_good_boolean_value_queries(self, case): + assert isinstance(self.parse(case), Tree) + + @pytest.mark.parametrize( + "case", + [ + 'name:surname HAS STARTS WITH "J":CONTAINS "Doe"', + 'title HAS ENDS WITH "MOF"', + 'elements HAS ALL STARTS WITH "S"', + ], + ) + def test_fuzzy_list_comparisons(self, case): + assert isinstance(self.parse(case), Tree)