paullik

Untitled

Apr 26th, 2012
49
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import unittest
  2. from mock import patch
  3.  
  4. def foo():
  5.     my_list = []
  6.  
  7. class Test(unittest.TestCase):
  8.     def test_foo(self):
  9.         with patch('__main__.my_list', new=[], create=True) as baz:
  10.             baz.extend(['foo', 'bar'])
  11.  
  12.             self.assertEqual(foo(), None)
  13.             self.assertListEqual([], baz)
  14.  
  15. if __name__ == '__main__':
  16.     unittest.main()
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×