summaryrefslogtreecommitdiff
path: root/tests/test_format.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_format.py')
-rw-r--r--tests/test_format.py43
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/test_format.py b/tests/test_format.py
index acee9ac..a95b3d1 100644
--- a/tests/test_format.py
+++ b/tests/test_format.py
@@ -554,6 +554,49 @@ class TestFormatReindent(object):
' nvl(1)',
'from dual'])
+ def test_insert_values(self):
+ # issue 329
+ f = lambda sql: sqlparse.format(sql, reindent=True)
+ s = 'insert into foo values (1, 2)'
+ assert f(s) == '\n'.join([
+ 'insert into foo',
+ 'values (1, 2)'])
+
+ s = 'insert into foo values (1, 2), (3, 4), (5, 6)'
+ assert f(s) == '\n'.join([
+ 'insert into foo',
+ 'values (1, 2),',
+ ' (3, 4),',
+ ' (5, 6)'])
+
+ s = 'insert into foo(a, b) values (1, 2), (3, 4), (5, 6)'
+ assert f(s) == '\n'.join([
+ 'insert into foo(a, b)',
+ 'values (1, 2),',
+ ' (3, 4),',
+ ' (5, 6)'])
+
+ f = lambda sql: sqlparse.format(sql, reindent=True,
+ comma_first=True)
+ s = 'insert into foo values (1, 2)'
+ assert f(s) == '\n'.join([
+ 'insert into foo',
+ 'values (1, 2)'])
+
+ s = 'insert into foo values (1, 2), (3, 4), (5, 6)'
+ assert f(s) == '\n'.join([
+ 'insert into foo',
+ 'values (1, 2)',
+ ' , (3, 4)',
+ ' , (5, 6)'])
+
+ s = 'insert into foo(a, b) values (1, 2), (3, 4), (5, 6)'
+ assert f(s) == '\n'.join([
+ 'insert into foo(a, b)',
+ 'values (1, 2)',
+ ' , (3, 4)',
+ ' , (5, 6)'])
+
class TestOutputFormat(object):
def test_python(self):