summaryrefslogtreecommitdiff
path: root/tests/test_parse.py
diff options
context:
space:
mode:
authorAndi Albrecht <albrecht.andi@gmail.com>2013-06-29 19:12:53 +0200
committerAndi Albrecht <albrecht.andi@gmail.com>2013-06-29 19:14:58 +0200
commit84725ee64570622135bf68d87823643b826d05b6 (patch)
treed340ae595b2a22c31fa192df6806c3f412fb76a9 /tests/test_parse.py
parent4edfd2fe0ac4e6aca1ee014ea47f9d6b13bfcfbe (diff)
downloadsqlparse-84725ee64570622135bf68d87823643b826d05b6.tar.gz
Improve parsing of PEP249-style placeholder (fixes #103).
Diffstat (limited to 'tests/test_parse.py')
-rw-r--r--tests/test_parse.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/test_parse.py b/tests/test_parse.py
index 7016af9..10da8e1 100644
--- a/tests/test_parse.py
+++ b/tests/test_parse.py
@@ -2,11 +2,15 @@
"""Tests sqlparse function."""
+import pytest
+
from tests.utils import TestCaseBase
import sqlparse
import sqlparse.sql
+from sqlparse import tokens as T
+
class SQLParseTest(TestCaseBase):
"""Tests sqlparse.parse()."""
@@ -139,3 +143,10 @@ def test_psql_quotation_marks(): # issue83
....
$PROC_2$ LANGUAGE plpgsql;""")
assert len(t) == 2
+
+
+@pytest.mark.parametrize('ph', ['?', ':1', ':foo', '%s', '%(foo)s'])
+def test_placeholder(ph):
+ p = sqlparse.parse(ph)[0].tokens
+ assert len(p) == 1
+ assert p[0].ttype is T.Name.Placeholder