diff options
Diffstat (limited to 'Lib/unittest/test/testmock/support.py')
| -rw-r--r-- | Lib/unittest/test/testmock/support.py | 23 | 
1 files changed, 23 insertions, 0 deletions
diff --git a/Lib/unittest/test/testmock/support.py b/Lib/unittest/test/testmock/support.py new file mode 100644 index 0000000000..f4738793b3 --- /dev/null +++ b/Lib/unittest/test/testmock/support.py @@ -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  | 
