fork download
  1. class Foo():
  2. def __init__(self):
  3. self.bar = 'foo'
  4. pass
  5.  
  6. from unittest import mock
  7.  
  8. def test_foo():
  9. Foo.bar = property(mock.Mock(side_effect=[1, 2]), mock.Mock())
  10. f = Foo()
  11. print(f.bar)
  12. print(f.bar)
  13. del Foo.bar
  14.  
  15. test_foo()
Success #stdin #stdout 0.07s 16668KB
stdin
Standard input is empty
stdout
1
2