diff options
Diffstat (limited to 'tests/test_split.py')
| -rw-r--r-- | tests/test_split.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/tests/test_split.py b/tests/test_split.py index 29ee72e..321fca2 100644 --- a/tests/test_split.py +++ b/tests/test_split.py @@ -1,4 +1,3 @@ - # -*- coding: utf-8 -*- # Tests splitting functions. @@ -116,3 +115,18 @@ class SQLSplitTest(TestCaseBase): 'SELECT t FROM two') stmts = sqlparse.split(sql) self.assertEqual(len(stmts), 2) + + def test_split_stream(self): + import types + from cStringIO import StringIO + + stream = StringIO("SELECT 1; SELECT 2;") + stmts = sqlparse.parsestream(stream) + self.assertEqual(type(stmts), types.GeneratorType) + self.assertEqual(len(list(stmts)), 2) + + def test_encoding_parsestream(self): + from cStringIO import StringIO + stream = StringIO("SELECT 1; SELECT 2;") + stmts = list(sqlparse.parsestream(stream)) + self.assertEqual(type(stmts[0].tokens[0].value), unicode) |
