From fb6b59dece40a608a1c6cf741a4ac6ee88d85d2f Mon Sep 17 00:00:00 2001 From: Andi Albrecht Date: Sun, 26 Jul 2015 11:20:49 +0200 Subject: Ignore comments at beginning of statement when calling Statement.get_type (fixes #186). --- tests/test_regressions.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tests') diff --git a/tests/test_regressions.py b/tests/test_regressions.py index 6da94dc..ea8cd56 100644 --- a/tests/test_regressions.py +++ b/tests/test_regressions.py @@ -255,3 +255,9 @@ END; SELECT * FROM a.b;""" splitted = sqlparse.split(sql) assert len(splitted) == 2 + + +def test_issue186_get_type(): + sql = "-- comment\ninsert into foo" + p = sqlparse.parse(sql)[0] + assert p.get_type() == 'INSERT' -- cgit v1.2.1