示例#1
0
 def test_unstub_returns_back_original_method_even_in_multiple_stubs(self):
     other_value = object()
     stubydoo.stub(self.object.method)
     stubydoo.stub(self.object.method).with_args('arg', 1, foo='bar').\
         and_return(other_value)
     stubydoo.unstub(self.object.method)
     self.assertTrue(self.object.method() is self.original_value)
示例#2
0
    def test_unstubbing(self):
        stubydoo.stub(self.double, 'method')
        stubydoo.unstub(self.double.method)

        try:
            self.double.method
        except AttributeError:
            pass
        else:
            self.fail()
示例#3
0
 def test_unstub_non_existing_attribute(self):
     stubydoo.stub(self.double, foo='baz')
     stubydoo.unstub(self.double, 'foo')
     self.assertTrue(not hasattr(self.double, 'foo'))
示例#4
0
 def test_unstub_existing_attribute(self):
     self.double.foo = 'bar'
     stubydoo.stub(self.double, foo='baz')
     stubydoo.unstub(self.double, 'foo')
     self.assertEquals(self.double.foo, 'bar')
示例#5
0
 def test_unstub_returns_back_original_method(self):
     stubydoo.stub(self.object.method)
     stubydoo.unstub(self.object.method)
     self.assertTrue(self.object.method() is self.original_value)
示例#6
0
 def test_fails_silently(self):
     stubydoo.unstub(self.object.method)