Esempio n. 1
0
 def test_patchTwice_expectNoSideEffect(self):
     petour.patch('petourtest.sut_', class_dot_methods=['FooBar.count'])
     petour.patch('petourtest.sut_', class_dot_methods=['FooBar.count'])
     self.assertEqual(1, len(petour.petours()))
     self.assertEqual(1, foobar(1))
     ctx = petour.context_manager('petourtest.sut_', 'FooBar.count')
     self.assertTrue(ctx)
     petour.unpatch_all()
     self.assertEqual(0, len(petour.petours()))
     ctx = petour.context_manager('petourtest.sut_', 'FooBar.count')
     self.assertFalse(ctx)
Esempio n. 2
0
 def test_patchTwice_expectNoSideEffect(self):
     petour.patch('petourtest.sut_', class_dot_methods=['FooBar.count'])
     petour.patch('petourtest.sut_', class_dot_methods=['FooBar.count'])
     self.assertEqual(1, len(petour.petours()))
     self.assertEqual(1, foobar(1))
     ctx = petour.context_manager('petourtest.sut_', 'FooBar.count')
     self.assertTrue(ctx)
     petour.unpatch_all()
     self.assertEqual(0, len(petour.petours()))
     ctx = petour.context_manager('petourtest.sut_', 'FooBar.count')
     self.assertFalse(ctx)
Esempio n. 3
0
 def test_patchTwice_expectNoSideEffect(self):
     petour.patch('petourtest.sut_', free_func_names=['foobar'])
     petour.patch('petourtest.sut_', free_func_names=['foobar'])
     self.assertEqual(1, len(petour.petours()))
     self.assertEqual(1, foobar(1))
     ctx = petour.context_manager('petourtest.sut_', 'foobar')
     self.assertTrue(ctx)
     petour.unpatch_all()
     self.assertEqual(0, len(petour.petours()))
     ctx = petour.context_manager('petourtest.sut_', 'foobar')
     self.assertFalse(ctx)
Esempio n. 4
0
 def test_patchTwice_expectNoSideEffect(self):
     petour.patch('petourtest.sut_', free_func_names=['foobar'])
     petour.patch('petourtest.sut_', free_func_names=['foobar'])
     self.assertEqual(1, len(petour.petours()))
     self.assertEqual(1, foobar(1))
     ctx = petour.context_manager('petourtest.sut_', 'foobar')
     self.assertTrue(ctx)
     petour.unpatch_all()
     self.assertEqual(0, len(petour.petours()))
     ctx = petour.context_manager('petourtest.sut_', 'foobar')
     self.assertFalse(ctx)
Esempio n. 5
0
 def test_expectPetourCount(self):
     petour.patch('petourtest.sut_', free_func_names=['foobar'])
     self.assertEqual(1, len(petour.petours()))
Esempio n. 6
0
 def test_initialState_expectNoPetourCount(self):
     self.assertFalse(petour.petours())
Esempio n. 7
0
 def test_canNotPatchClassAttribute(self):
     petour.patch('petourtest.sut_', class_dot_methods=['FooBar.IDDQD'])
     self.assertFalse(petour.petours())
Esempio n. 8
0
 def test_canNotPatchStaticVariable(self):
     petour.patch('petourtest.sut_', free_func_names=['beef'])
     self.assertFalse(petour.petours())
Esempio n. 9
0
 def test_unpatchAll_expectNoPetourCount(self):
     petour.patch('petourtest.sut_', class_dot_methods=['FooBar.count'])
     petour.unpatch_all()
     self.assertFalse(petour.petours())
Esempio n. 10
0
 def test_unpatchAll_expectNoPetourCount(self):
     petour.patch('petourtest.sut_', class_dot_methods=['FooBar.count'])
     petour.unpatch_all()
     self.assertFalse(petour.petours())
Esempio n. 11
0
 def test_unpatchAll_expectNoPetourCount(self):
     petour.patch('petourtest.sut_', free_func_names=['foobar'])
     petour.unpatch_all()
     self.assertFalse(petour.petours())
Esempio n. 12
0
 def test_expectPetourCount(self):
     petour.patch('petourtest.sut_', free_func_names=['foobar'])
     self.assertEqual(1, len(petour.petours()))
Esempio n. 13
0
 def test_initialState_expectNoPetourCount(self):
     self.assertFalse(petour.petours())
Esempio n. 14
0
 def test_canNotPatchClassAttribute(self):
     petour.patch('petourtest.sut_', class_dot_methods=['FooBar.IDDQD'])
     self.assertFalse(petour.petours())
Esempio n. 15
0
 def test_canNotPatchStaticVariable(self):
     petour.patch('petourtest.sut_', free_func_names=['beef'])
     self.assertFalse(petour.petours())
Esempio n. 16
0
 def test_unpatchAll_expectNoPetourCount(self):
     petour.patch('petourtest.sut_', free_func_names=['foobar'])
     petour.unpatch_all()
     self.assertFalse(petour.petours())
Esempio n. 17
0
 def test_expectPetourCount(self):
     petour.patch('petourtest.sut_', class_dot_methods=['FooBar.count'])
     self.assertEqual(1, len(petour.petours()))
Esempio n. 18
0
 def test_expectPetourCount(self):
     petour.patch('petourtest.sut_', class_dot_methods=['FooBar.count'])
     self.assertEqual(1, len(petour.petours()))