Advertisement
Guest User

Untitled

a guest
Apr 6th, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. from mock import *
  2.  
  3. class Test:
  4. def a(self):
  5. print('Test')
  6.  
  7. class Mock:
  8. def a(self):
  9. print('Mock')
  10.  
  11. @patch('__main__.Test', new=Mock)
  12. def patched_class():
  13. t=Test()
  14. t.a()
  15.  
  16. def not_patched_class():
  17. t=Test()
  18. t.a()
  19.  
  20. patched_class()
  21. not_patched_class()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement