Anonymous avatar Anonymous committed 0d6a0a1

Renamed test class, moved some common code

Comments (0)

Files changed (1)

nose2/tests/test_loader_plugin.py

 
 from ..plugins import loader
 
-class LoaderUnitTests(unittest2.TestCase):
+class TestGeneratorUnpack(unittest2.TestCase):
     tags = ['unit']
 
+    def setUp(self):
+        self.expect = [(0, ('call', (0, 1))),
+                       (1, ('call', (1, 2))),
+                       (2, ('call', (2, 3))),]
+
     def test_unpack_handles_nose_style_generators(self):
         def gen():
             for i in range(0, 3):
                 yield 'call', i, i + 1
-        expect = [(0, ('call', (0, 1))),
-                  (1, ('call', (1, 2))),
-                  (2, ('call', (2, 3))),]
         out = list(loader.Functions().unpack(gen()))
-        self.assertEqual(out, expect)
+        self.assertEqual(out, self.expect)
 
     def test_unpack_handles_unittest2_style_generators(self):
         def gen():
             for i in range(0, 3):
                 yield 'call', (i, i + 1)
-        expect = [(0, ('call', (0, 1))),
-                  (1, ('call', (1, 2))),
-                  (2, ('call', (2, 3))),]
         out = list(loader.Functions().unpack(gen()))
-        self.assertEqual(out, expect)
+        self.assertEqual(out, self.expect)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.