示例#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)
示例#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)
示例#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)
示例#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)
示例#5
0
 def test_expectPetourCount(self):
     petour.patch('petourtest.sut_', free_func_names=['foobar'])
     self.assertEqual(1, len(petour.petours()))
示例#6
0
 def test_initialState_expectNoPetourCount(self):
     self.assertFalse(petour.petours())
示例#7
0
 def test_canNotPatchClassAttribute(self):
     petour.patch('petourtest.sut_', class_dot_methods=['FooBar.IDDQD'])
     self.assertFalse(petour.petours())
示例#8
0
 def test_canNotPatchStaticVariable(self):
     petour.patch('petourtest.sut_', free_func_names=['beef'])
     self.assertFalse(petour.petours())
示例#9
0
 def test_unpatchAll_expectNoPetourCount(self):
     petour.patch('petourtest.sut_', class_dot_methods=['FooBar.count'])
     petour.unpatch_all()
     self.assertFalse(petour.petours())
示例#10
0
 def test_unpatchAll_expectNoPetourCount(self):
     petour.patch('petourtest.sut_', class_dot_methods=['FooBar.count'])
     petour.unpatch_all()
     self.assertFalse(petour.petours())
示例#11
0
 def test_unpatchAll_expectNoPetourCount(self):
     petour.patch('petourtest.sut_', free_func_names=['foobar'])
     petour.unpatch_all()
     self.assertFalse(petour.petours())
示例#12
0
 def test_expectPetourCount(self):
     petour.patch('petourtest.sut_', free_func_names=['foobar'])
     self.assertEqual(1, len(petour.petours()))
示例#13
0
 def test_initialState_expectNoPetourCount(self):
     self.assertFalse(petour.petours())
示例#14
0
 def test_canNotPatchClassAttribute(self):
     petour.patch('petourtest.sut_', class_dot_methods=['FooBar.IDDQD'])
     self.assertFalse(petour.petours())
示例#15
0
 def test_canNotPatchStaticVariable(self):
     petour.patch('petourtest.sut_', free_func_names=['beef'])
     self.assertFalse(petour.petours())
示例#16
0
 def test_unpatchAll_expectNoPetourCount(self):
     petour.patch('petourtest.sut_', free_func_names=['foobar'])
     petour.unpatch_all()
     self.assertFalse(petour.petours())
示例#17
0
 def test_expectPetourCount(self):
     petour.patch('petourtest.sut_', class_dot_methods=['FooBar.count'])
     self.assertEqual(1, len(petour.petours()))
示例#18
0
 def test_expectPetourCount(self):
     petour.patch('petourtest.sut_', class_dot_methods=['FooBar.count'])
     self.assertEqual(1, len(petour.petours()))