diff options
| author | Victor Uriarte <victor.m.uriarte@intel.com> | 2016-06-10 21:31:34 -0700 |
|---|---|---|
| committer | Victor Uriarte <victor.m.uriarte@intel.com> | 2016-06-11 04:35:14 -0700 |
| commit | 29e3df5c2c0a62f16668f89f4a5e738156c276a7 (patch) | |
| tree | 6af0878e58bd97824cd28571db1074a6391a7c37 /tests/test_format.py | |
| parent | b99b6f214eab7fe8f08a7a7d2a1f57e0826ae83a (diff) | |
| download | sqlparse-29e3df5c2c0a62f16668f89f4a5e738156c276a7.tar.gz | |
Add multi-statement output tests
Diffstat (limited to 'tests/test_format.py')
| -rw-r--r-- | tests/test_format.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/test_format.py b/tests/test_format.py index 8ca19d9..74fce71 100644 --- a/tests/test_format.py +++ b/tests/test_format.py @@ -524,6 +524,22 @@ class TestOutputFormat(TestCaseBase): self.ndiffAssertEqual(f(sql), ("sql = ('select * '\n" " 'from foo;')")) + def test_python_multiple_statements(self): + sql = 'select * from foo; select 1 from dual' + f = lambda sql: sqlparse.format(sql, output_format='python') + self.ndiffAssertEqual(f(sql), ("sql = 'select * from foo; '\n" + "sql2 = 'select 1 from dual'")) + + @pytest.mark.xfail(reason="Needs fixing") + def test_python_multiple_statements_with_formatting(self): + sql = 'select * from foo; select 1 from dual' + f = lambda sql: sqlparse.format(sql, output_format='python', + reindent=True) + self.ndiffAssertEqual(f(sql), ("sql = ('select * '\n" + " 'from foo;')\n" + "sql2 = ('select 1 '\n" + " 'from dual')")) + def test_php(self): sql = 'select * from foo;' f = lambda sql: sqlparse.format(sql, output_format='php') |
