import sys info = sys.version_info import unittest2 try: callable = callable except NameError: def callable(obj): return hasattr(obj, '__call__') with_available = sys.version_info[:2] >= (2, 5) 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 try: next = next except NameError: def next(obj): return obj.next()
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
__pycache__ | Folder | 0755 |
|
|
__init__.py | File | 146 B | 0644 |
|
__main__.py | File | 623 B | 0644 |
|
support.py | File | 552 B | 0644 |
|
testcallable.py | File | 4.33 KB | 0644 |
|
testhelpers.py | File | 28.02 KB | 0644 |
|
testmagicmethods.py | File | 16 KB | 0644 |
|
testmock.py | File | 49.29 KB | 0644 |
|
testpatch.py | File | 55.03 KB | 0644 |
|
testsentinel.py | File | 976 B | 0644 |
|
testwith.py | File | 10.34 KB | 0644 |
|