diff options
| author | quest <quest@wonky.windwards.net> | 2012-04-21 19:57:26 +0200 |
|---|---|---|
| committer | quest <quest@wonky.windwards.net> | 2012-04-21 19:57:26 +0200 |
| commit | 7631460377274f6a9e074c974e2d63dafb1938eb (patch) | |
| tree | c3df43be3a0e5c43f42353c83b991b665f4c7c51 /tests/test_split.py | |
| parent | 0afebf47e24d8a1ee1981faef39c0a15a798f7fd (diff) | |
| download | sqlparse-7631460377274f6a9e074c974e2d63dafb1938eb.tar.gz | |
We can now work with file-like objects.
Diffstat (limited to 'tests/test_split.py')
| -rw-r--r-- | tests/test_split.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/test_split.py b/tests/test_split.py index 29ee72e..c73d9d4 100644 --- a/tests/test_split.py +++ b/tests/test_split.py @@ -116,3 +116,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.splitstream(stream) + self.assertEqual(type(stmts), types.GeneratorType) + self.assertEqual(len(list(stmts)), 2) + + def test_encoding_splitstream(self): + from cStringIO import StringIO + stream = StringIO("SELECT 1; SELECT 2;") + stmts = list(sqlparse.splitstream(stream)) + self.assertEqual(type(stmts[0].tokens[0].value), unicode) |
