Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
"""Compatibility between Py2 and Py3."""
PY3 = sys.version_info == 3
8 ↛ 9line 8 didn't jump to line 9, because the condition on line 8 was never trueif PY3:
string_types = (str,bytes)
bytes_types = (bytes,)
string_types = (basestring,)
bytes_types = (str,)
# Pythons 2 and 3 differ on where to get StringIO
from cStringIO import StringIO
from io import StringIO
"""Does `unittest.TestCase` have `method` defined?"""
return hasattr(unittest.TestCase, method)
"""Just like unittest.TestCase, but with assert methods added.
Designed to be compatible with 3.1 unittest. Methods are only defined if
`unittest` doesn't have them.
# pylint: disable=missing-docstring
40 ↛ exitline 40 didn't exit the body of class 'TestCase', because the condition on line 40 was never false if not unittest_has('assertRaisesRegex'):
def assertRaisesRegex(self, *args, **kwargs):
return self.assertRaisesRegexp(*args, **kwargs)