예제 #1
0
    def test_restores_original_value(self):
        original_value = doubles.testing.User
        patch('doubles.testing.User', 'Bob Barker')

        teardown()

        assert original_value == doubles.testing.User
예제 #2
0
    def test_restores_original_value(self):
        original_value = doubles.testing.User
        patch('doubles.testing.User', 'Bob Barker')

        teardown()

        assert original_value == doubles.testing.User
예제 #3
0
 def test_patch_non_existent_object(self):
     with pytest.raises(VerifyingDoubleError):
         patch('doubles.testing.NotReal', True)
예제 #4
0
    def test_creating_instance_double_after_patching(self):
        patch('doubles.testing.User', InstanceDouble('doubles.testing.User'))

        assert InstanceDouble('doubles.testing.User')
예제 #5
0
    def test_patch_wth_new_object_supplied(self):
        patch('doubles.testing.User', 'Bob Barker')

        assert doubles.testing.User == 'Bob Barker'
예제 #6
0
 def test_patch_non_existent_object(self):
     with pytest.raises(VerifyingDoubleError):
         patch('doubles.testing.NotReal', True)
예제 #7
0
    def test_creating_instance_double_after_patching(self):
        patch('doubles.testing.User', InstanceDouble('doubles.testing.User'))

        assert InstanceDouble('doubles.testing.User')
예제 #8
0
    def test_patch_wth_new_object_supplied(self):
        patch('doubles.testing.User', 'Bob Barker')

        assert doubles.testing.User == 'Bob Barker'