summaryrefslogtreecommitdiff
path: root/tests/test_split.py
diff options
context:
space:
mode:
authorJesús Leganés Combarro "Piranna <piranna@gmail.com>2012-04-23 01:38:52 +0200
committerJesús Leganés Combarro "Piranna <piranna@gmail.com>2012-04-23 01:38:52 +0200
commit2d8fa9e4ac7358d70dc751b497ca21df89fef757 (patch)
treea6d0efd96bca5aba5cabf1cd8ca416a552e90695 /tests/test_split.py
parent91e44ff73d6bf0762b8bda4d18957e29ce2d52ae (diff)
parent9b643b52bfd59b583094d08615c7bd698f98e576 (diff)
downloadsqlparse-2d8fa9e4ac7358d70dc751b497ca21df89fef757.tar.gz
Merge branch 'master' of github.com:andialbrecht/sqlparse
Diffstat (limited to 'tests/test_split.py')
-rw-r--r--tests/test_split.py16
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)