support.py 413 B

123456789101112131415161718192021222324
  1. target = {'foo': 'FOO'}
  2. def is_instance(obj, klass):
  3. """Version of is_instance that doesn't access __class__"""
  4. return issubclass(type(obj), klass)
  5. class SomeClass(object):
  6. class_attribute = None
  7. def wibble(self):
  8. pass
  9. class X(object):
  10. pass
  11. def examine_warnings(func):
  12. def wrapper():
  13. with catch_warnings(record=True) as ws:
  14. func(ws)
  15. return wrapper