Commits

Eric Larson committed 84727f8

Added tests for whitespace

Comments (0)

Files changed (1)

tests/test_parser.py

 
 class TestParser(object):
 
+    @pytest.mark.parametrize(
+        ('query',), [
+            ('x : y',),
+            ('x : y , a : b',),
+            ('" x > y | x < z " , "a > b , a < c"',),
+            ('x > y, a > b',),
+        ])
+    def test_whitespace(self, query):
+        """
+        Makesure we get the same results no matter the whitespace.
+        """
+        p = Parser()
+        withspace = Query(p.parse(query)).as_dict()
+        nospace = Query(p.parse(query.replace(' ', ''))).as_dict()
+        assert withspace == nospace
+
     def test_operators(self):
         p = Parser()
         eq = Query(p.parse('x:y'))
     def test_map(self, query, expected):
         q = self.get_query(query)
         assert q.as_dict() == expected
+