diff options
| author | Andi Albrecht <albrecht.andi@gmail.com> | 2013-03-18 06:11:46 +0100 |
|---|---|---|
| committer | Andi Albrecht <albrecht.andi@gmail.com> | 2013-03-18 06:11:46 +0100 |
| commit | abb8ce291e275e9879154ee0f22e881de8cf0ca4 (patch) | |
| tree | e0d9b6cb7aa9eae98f04e24d631d7584171f8885 /tests | |
| parent | 58134785ce80f43529c328e1c36a45739f3d84eb (diff) | |
| download | sqlparse-abb8ce291e275e9879154ee0f22e881de8cf0ca4.tar.gz | |
Fix internals of _group_left_right, avoid identifying keywords as aliased identifiers.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_regressions.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/test_regressions.py b/tests/test_regressions.py index 24fb10f..94d644f 100644 --- a/tests/test_regressions.py +++ b/tests/test_regressions.py @@ -178,3 +178,13 @@ def test_parse_sql_with_binary(): if sys.version_info < (3,): tformatted = tformatted.decode('unicode-escape') assert formatted == tformatted + + +def test_dont_alias_keywords(): + # The _group_left_right function had a bug where the check for the + # left side wasn't handled correctly. In one case this resulted in + # a keyword turning into an identifier. + p = sqlparse.parse('FROM AS foo')[0] + assert len(p.tokens) == 5 + assert p.tokens[0].ttype is T.Keyword + assert p.tokens[2].ttype is T.Keyword |
