PEP 417: Adding unittest.mock

This commit is contained in:
Michael Foord 2012-03-14 12:24:34 -07:00
parent 8d8f110492
commit 345266aa7e
11 changed files with 6682 additions and 0 deletions

View file

@ -0,0 +1,23 @@
import sys
def is_instance(obj, klass):
"""Version of is_instance that doesn't access __class__"""
return issubclass(type(obj), klass)
class SomeClass(object):
class_attribute = None
def wibble(self):
pass
class X(object):
pass
def examine_warnings(func):
def wrapper():
with catch_warnings(record=True) as ws:
func(ws)
return wrapper