]> git.phdru.name Git - sqlconvert.git/commitdiff
Simplify test: use 'for' loop to loop over generator
authorOleg Broytman <phd@phdru.name>
Wed, 24 Aug 2016 14:42:37 +0000 (17:42 +0300)
committerOleg Broytman <phd@phdru.name>
Wed, 24 Aug 2016 14:42:37 +0000 (17:42 +0300)
tests/test_stgrouper.py

index 36a14c2c6350b7ff76b86e63716ac7e76ed7e711..cb4f88f0aa30194d3cac8d7d351adb34c9459044 100755 (executable)
@@ -24,12 +24,10 @@ class TestStGrouper(unittest.TestCase):
         grouper.process(parsed)
         self.assertTrue(grouper.statements)
         self.assertEqual(len(grouper.statements), 1)
-        g = grouper.get_statements()
-        statement = next(g)
-        requote_names(statement)
-        query = tlist2str(parsed)
-        self.assertEqual(query, 'SELECT * FROM "T";')
-        self.assertRaises(StopIteration, next, g)
+        for statement in grouper.get_statements():
+            requote_names(statement)
+            query = tlist2str(statement)
+            self.assertEqual(query, 'SELECT * FROM "T";')
         self.assertEqual(len(grouper.statements), 0)
         self.assertEqual(grouper.close(), [])