summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorErik Cederstrand <erik@adamatics.com>2022-08-16 13:49:36 +0200
committerAndi Albrecht <albrecht.andi@gmail.com>2022-08-16 15:50:38 +0200
commit3d3df9dcfb68dc3680daa81ac0f747bb3703ad57 (patch)
tree176b883267e81a9f250be8014c0ed6e692088606 /tests
parent9d2cb6fc950386e9e59f29faf0d3742c4b12572c (diff)
downloadsqlparse-3d3df9dcfb68dc3680daa81ac0f747bb3703ad57.tar.gz
Make tzcast grouping function less eager
Diffstat (limited to 'tests')
-rw-r--r--tests/test_regressions.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/test_regressions.py b/tests/test_regressions.py
index 38d1840..4ffc69f 100644
--- a/tests/test_regressions.py
+++ b/tests/test_regressions.py
@@ -401,6 +401,15 @@ def test_issue489_tzcasts():
assert p.tokens[-1].get_alias() == 'foo'
+def test_issue562_tzcasts():
+ # Test that whitespace between 'from' and 'bar' is retained
+ formatted = sqlparse.format(
+ 'SELECT f(HOUR from bar AT TIME ZONE \'UTC\') from foo', reindent=True
+ )
+ assert formatted == \
+ 'SELECT f(HOUR\n from bar AT TIME ZONE \'UTC\')\nfrom foo'
+
+
def test_as_in_parentheses_indents():
# did raise NoneType has no attribute is_group in _process_parentheses
formatted = sqlparse.format('(as foo)', reindent=True)