From: Oleg Broytman Date: Wed, 24 Aug 2016 14:42:37 +0000 (+0300) Subject: Simplify test: use 'for' loop to loop over generator X-Git-Tag: 0.0.1~22 X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=196c2e0ff729c9cf772bb0e9b521ce4f4fdf84cb;p=sqlconvert.git Simplify test: use 'for' loop to loop over generator --- diff --git a/tests/test_stgrouper.py b/tests/test_stgrouper.py index 36a14c2..cb4f88f 100755 --- a/tests/test_stgrouper.py +++ b/tests/test_stgrouper.py @@ -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(), [])