Commits

dja...@online.ua  committed 3cba036

Additional test cases

  • Participants
  • Parent commits 376fac0

Comments (0)

Files changed (1)

File mockstar_test.py

 
 
 class TestPatch(TestCase):
-    @p(__name__ + '.side_effect_one', __name__ + '.side_effect_two')
+    @p(__name__ + '.side_effect_one')
+    @p(__name__ + '.side_effect_two')
     def test_should_mock_to_kw(self, se):
         self.assertIsInstance(se.side_effect_one, MagicMock)
         self.assertIsInstance(se.side_effect_two, MagicMock)
         self.assertRaises(TypeError, lambda: se.side_effect_five())
 
 
+class TestMultiPatch(TestCase):
+    @p(__name__ + '.side_effect_one', __name__ + '.side_effect_two')
+    def test_should_mock_to_kw(self, se):
+        self.assertIsInstance(se.side_effect_one, MagicMock)
+        self.assertIsInstance(se.side_effect_two, MagicMock)
+
+
 class TestM(TestCase):
     def test_should_create_object(self):
         m = M()
     #     # self.assertIsInstance(m, M)
 
 
+@ppatch('side_effect_one')
+@ppatch('side_effect_two')
+class TestPatchClass(TestCase):
+    def test_should_get_se(self, se):
+        self.assertIsInstance(se.side_effect_one, MagicMock)
+        self.assertIsInstance(se.side_effect_two, MagicMock)
+
+    def test_should_also_get_se(self, se):
+        self.assertIsInstance(se.side_effect_one, MagicMock)
+        self.assertIsInstance(se.side_effect_two, MagicMock)
+
+
 @ppatch('side_effect_one', 'side_effect_two')
-class TestPatchClass(TestCase):
+class TestMultiPatchClass(TestCase):
     def test_should_get_se(self, se):
         self.assertIsInstance(se.side_effect_one, MagicMock)
         self.assertIsInstance(se.side_effect_two, MagicMock)