tests/test-wireproto-framing.py
changeset 37715 1859b9a7ddef
parent 37542 1ec5ce21cb46
child 39410 fcc6bd11444b
--- a/tests/test-wireproto-framing.py	Sat Apr 14 11:07:24 2018 -0400
+++ b/tests/test-wireproto-framing.py	Sat Apr 14 11:20:38 2018 -0400
@@ -103,19 +103,25 @@
             ffs(b'1 1 0 command-data eos %s' % data.getvalue()),
         ])
 
+    if not getattr(unittest.TestCase, 'assertRaisesRegex', False):
+        # Python 3.7 deprecates the regex*p* version, but 2.7 lacks
+        # the regex version.
+        assertRaisesRegex = (# camelcase-required
+            unittest.TestCase.assertRaisesRegexp)
+
     def testtextoutputformattingstringtype(self):
         """Formatting string must be bytes."""
-        with self.assertRaisesRegexp(ValueError, 'must use bytes formatting '):
+        with self.assertRaisesRegex(ValueError, 'must use bytes formatting '):
             list(framing.createtextoutputframe(None, 1, [
                 (b'foo'.decode('ascii'), [], [])]))
 
     def testtextoutputargumentbytes(self):
-        with self.assertRaisesRegexp(ValueError, 'must use bytes for argument'):
+        with self.assertRaisesRegex(ValueError, 'must use bytes for argument'):
             list(framing.createtextoutputframe(None, 1, [
                 (b'foo', [b'foo'.decode('ascii')], [])]))
 
     def testtextoutputlabelbytes(self):
-        with self.assertRaisesRegexp(ValueError, 'must use bytes for labels'):
+        with self.assertRaisesRegex(ValueError, 'must use bytes for labels'):
             list(framing.createtextoutputframe(None, 1, [
                 (b'foo', [], [b'foo'.decode('ascii')])]))