summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorOleg Broytman <phd@phdru.name>2016-08-05 22:18:40 +0300
committerOleg Broytman <phd@phdru.name>2016-08-06 01:47:51 +0300
commit17d5f8c1b6002019d5f078fbc6a56f351a5efeef (patch)
tree2f8133297f074d30cebf58f741cbc3736f32b3b9 /tests
parentb7e6ce7b7f687be884eea65df0e576c15b0331dc (diff)
downloadsqlparse-17d5f8c1b6002019d5f078fbc6a56f351a5efeef.tar.gz
Avoid double apostrophes
If the value is Single it's already quoted with apostrophes. Avoid double apostrophes it that case by using double-quotes instead. For example, if the value is 'value' the output is "'value'" instead of ''value''.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_tokenize.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/test_tokenize.py b/tests/test_tokenize.py
index 6cc0dfa..93645d8 100644
--- a/tests/test_tokenize.py
+++ b/tests/test_tokenize.py
@@ -95,6 +95,12 @@ def test_tokenlist_repr():
assert repr(p.tokens[0])[:len(tst)] == tst
+def test_single_quotes():
+ p = sqlparse.parse("'test'")[0]
+ tst = "<Single \"'test'\" at 0x"
+ assert repr(p.tokens[0])[:len(tst)] == tst
+
+
def test_tokenlist_first():
p = sqlparse.parse(' select foo')[0]
first = p.token_first()