Commit 0fb7c071 authored by Stefan Behnel's avatar Stefan Behnel

unittest fixes and work-arounds for older Python versions

parent 631e8b33
......@@ -224,7 +224,7 @@ class AsyncGenTest(unittest.TestCase):
if sys.version_info < (3, 3):
@contextlib.contextmanager
def assertRaisesRegex(self, exc_type, regex):
def assertRaisesRegex(self, exc_type, regex=None):
# the error messages usually don't match, so we just ignore them
try:
yield
......@@ -233,6 +233,16 @@ class AsyncGenTest(unittest.TestCase):
else:
self.assertTrue(False)
if sys.version_info < (2, 7):
def assertIn(self, x, container):
self.assertTrue(x in container)
def assertIs(self, x, y):
self.assertTrue(x is y)
assertRaises = assertRaisesRegex
def compare_generators(self, sync_gen, async_gen):
def sync_iterate(g):
res = []
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment