From 196c2e0ff729c9cf772bb0e9b521ce4f4fdf84cb Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Wed, 24 Aug 2016 17:42:37 +0300 Subject: [PATCH] Simplify test: use 'for' loop to loop over generator --- tests/test_stgrouper.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) 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(), []) -- 2.39.5