Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 3
0
 def test_patch_non_existent_object(self):
     with pytest.raises(VerifyingDoubleError):
         patch('doubles.testing.NotReal', True)
Exemplo n.º 4
0
    def test_creating_instance_double_after_patching(self):
        patch('doubles.testing.User', InstanceDouble('doubles.testing.User'))

        assert InstanceDouble('doubles.testing.User')
Exemplo n.º 5
0
    def test_patch_wth_new_object_supplied(self):
        patch('doubles.testing.User', 'Bob Barker')

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

        assert InstanceDouble('doubles.testing.User')
Exemplo n.º 8
0
    def test_patch_wth_new_object_supplied(self):
        patch('doubles.testing.User', 'Bob Barker')

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