Skip to content

Instantly share code, notes, and snippets.

@codeguru42
Last active February 21, 2018 23:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codeguru42/deda5b5fc982151c2a4d4f06959a0ad0 to your computer and use it in GitHub Desktop.
Save codeguru42/deda5b5fc982151c2a4d4f06959a0ad0 to your computer and use it in GitHub Desktop.
def foo(bar):
baz = bar.func()
if baz.name.lower()[-3:] == 'txt':
return baz.boo()
class MyTest(TestCase):
def testFoo(self):
bar = MagicMock()
bar.func.return_value = MagicMock(name='file.pdf')
x = foo(bar)
self.assertIsNone(bar)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment