From 8ffe95af292e0930b7126aae1905a97f7ebdfb24 Mon Sep 17 00:00:00 2001 From: Gavin Wahl Date: Thu, 7 Aug 2014 14:12:46 -0600 Subject: Handle modulo operator without spaces `x %3` should be interpreted as a modulo operation, not a parameter marker. Co-authored-by: Rocky Meza --- tests/test_parse.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tests/test_parse.py') diff --git a/tests/test_parse.py b/tests/test_parse.py index 6d7f7df..d77bb43 100644 --- a/tests/test_parse.py +++ b/tests/test_parse.py @@ -99,6 +99,10 @@ class SQLParseTest(TestCaseBase): self.assert_(t[-1].ttype is sqlparse.tokens.Name.Placeholder) self.assertEqual(t[-1].value, '$a') + def test_modulo_not_placeholder(self): + tokens = list(sqlparse.lexer.tokenize('x %3')) + self.assertEqual(tokens[2][0], sqlparse.tokens.Operator) + def test_access_symbol(self): # see issue27 t = sqlparse.parse('select a.[foo bar] as foo')[0].tokens self.assert_(isinstance(t[-1], sqlparse.sql.Identifier)) -- cgit v1.2.1