]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Replace deprecated unittest aliases 3052/head
authorHugo van Kemenade <hugovk@users.noreply.github.com>
Thu, 19 Aug 2021 10:21:09 +0000 (13:21 +0300)
committerHugo van Kemenade <hugovk@users.noreply.github.com>
Thu, 19 Aug 2021 10:21:09 +0000 (13:21 +0300)
tornado/test/concurrent_test.py
tornado/test/httpclient_test.py
tornado/test/iostream_test.py
tornado/test/log_test.py
tornado/test/options_test.py

index b121c6971a4fb8adba0c928d046a7cf8b85b821a..33fcb6505e6311ffb44cb1e3346446cfe4b7f04c 100644 (file)
@@ -122,7 +122,7 @@ class ClientTestMixin(object):
         future = self.client.capitalize("HELLO")
         self.io_loop.add_future(future, self.stop)
         self.wait()
-        self.assertRaisesRegexp(CapError, "already capitalized", future.result)  # type: ignore
+        self.assertRaisesRegex(CapError, "already capitalized", future.result)  # type: ignore
 
     def test_generator(self: typing.Any):
         @gen.coroutine
@@ -135,7 +135,7 @@ class ClientTestMixin(object):
     def test_generator_error(self: typing.Any):
         @gen.coroutine
         def f():
-            with self.assertRaisesRegexp(CapError, "already capitalized"):
+            with self.assertRaisesRegex(CapError, "already capitalized"):
                 yield self.client.capitalize("HELLO")
 
         self.io_loop.run_sync(f)
index fd9a978640d88d1ee750bbee64b0e500f75aed59..6021d6759bd9ddfa0a6996863da19a1836a575fe 100644 (file)
@@ -474,7 +474,7 @@ Transfer-Encoding: chunked
             streaming_callback=streaming_callback,
         )
         self.assertEqual(len(first_line), 1, first_line)
-        self.assertRegexpMatches(first_line[0], "HTTP/[0-9]\\.[0-9] 200.*\r\n")
+        self.assertRegex(first_line[0], "HTTP/[0-9]\\.[0-9] 200.*\r\n")
         self.assertEqual(chunks, [b"asdf", b"qwer"])
 
     @gen_test
index 797a2dfc1383ab080263597f2bf97e7b4b85679d..8e8e9f477a77783e9568705d56157623152da2f8 100644 (file)
@@ -784,7 +784,7 @@ class TestIOStreamMixin(TestReadWriteMixin):
                 "tornado.iostream.BaseIOStream._try_inline_read",
                 side_effect=IOError("boom"),
             ):
-                with self.assertRaisesRegexp(IOError, "boom"):
+                with self.assertRaisesRegex(IOError, "boom"):
                     client.read_until_close()
         finally:
             server.close()
index 8450e50b90ca930ecf07559fdc9f82a7086f0fba..77a0e594663bf536c69ff41ab5b192020d45bf9d 100644 (file)
@@ -112,7 +112,7 @@ class LogFormatterTest(unittest.TestCase):
         # This will be "Exception: \xe9" on python 2 or
         # "Exception: b'\xe9'" on python 3.
         output = self.get_output()
-        self.assertRegexpMatches(output, br"Exception.*\\xe9")
+        self.assertRegex(output, br"Exception.*\\xe9")
         # The traceback contains newlines, which should not have been escaped.
         self.assertNotIn(br"\n", output)
 
@@ -148,7 +148,7 @@ class EnablePrettyLoggingTest(unittest.TestCase):
             filenames = glob.glob(tmpdir + "/test_log*")
             self.assertEqual(1, len(filenames))
             with open(filenames[0]) as f:
-                self.assertRegexpMatches(f.read(), r"^\[E [^]]*\] hello$")
+                self.assertRegex(f.read(), r"^\[E [^]]*\] hello$")
         finally:
             for handler in self.logger.handlers:
                 handler.flush()
@@ -168,7 +168,7 @@ class EnablePrettyLoggingTest(unittest.TestCase):
             filenames = glob.glob(tmpdir + "/test_log*")
             self.assertEqual(1, len(filenames))
             with open(filenames[0]) as f:
-                self.assertRegexpMatches(f.read(), r"^\[E [^]]*\] hello$")
+                self.assertRegex(f.read(), r"^\[E [^]]*\] hello$")
         finally:
             for handler in self.logger.handlers:
                 handler.flush()
index 6aedbec32f3b7ec5c4f037f1308e285f806b276a..633703dc8b68e12561b910556719b036394304ca 100644 (file)
@@ -262,7 +262,7 @@ class OptionsTest(unittest.TestCase):
         options.define("foo")
         with self.assertRaises(Error) as cm:
             options.define("foo")
-        self.assertRegexpMatches(str(cm.exception), "Option.*foo.*already defined")
+        self.assertRegex(str(cm.exception), "Option.*foo.*already defined")
 
     def test_error_redefine_underscore(self):
         # Ensure that the dash/underscore normalization doesn't
@@ -279,7 +279,7 @@ class OptionsTest(unittest.TestCase):
                 options.define(a)
                 with self.assertRaises(Error) as cm:
                     options.define(b)
-                self.assertRegexpMatches(
+                self.assertRegex(
                     str(cm.exception), "Option.*foo.bar.*already defined"
                 )