From 44814f68545ecfe8dcd27363d9406f434fbea6c4 Mon Sep 17 00:00:00 2001 From: Karthikeyan Singaravelan Date: Thu, 14 Oct 2021 11:43:28 +0000 Subject: [PATCH 1/2] Use assertRegex instead of assertRegexpMatches for Python 3.11 compatibility. --- test/test_checks.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/test/test_checks.py b/test/test_checks.py index 0d9d82c..478cfb4 100644 --- a/test/test_checks.py +++ b/test/test_checks.py @@ -11,6 +11,10 @@ def test_get_noqa_lines(self): class TestFlake8Stdin(TestCase): + def setUp(self): + if not hasattr(self, 'assertRegex'): + self.assertRegex = self.assertRegexpMatches + def test_stdin(self): """Test using stdin.""" filepath = get_absolute_path('data/doubles.py') @@ -22,13 +26,13 @@ def test_stdin(self): stdout_lines = stdout.splitlines() self.assertEqual(stderr, b'') self.assertEqual(len(stdout_lines), 3) - self.assertRegexpMatches( + self.assertRegex( stdout_lines[0], b'stdin:1:(24|25): Q000 Double quotes found but single quotes preferred') - self.assertRegexpMatches( + self.assertRegex( stdout_lines[1], b'stdin:2:(24|25): Q000 Double quotes found but single quotes preferred') - self.assertRegexpMatches( + self.assertRegex( stdout_lines[2], b'stdin:3:(24|25): Q000 Double quotes found but single quotes preferred') From a57021e018eb4234e071fb944c05e28bee2fab9f Mon Sep 17 00:00:00 2001 From: Todd Wolfson Date: Thu, 14 Oct 2021 18:44:28 -0700 Subject: [PATCH 2/2] Removed `assertRegex` fallback --- test/test_checks.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/test/test_checks.py b/test/test_checks.py index 478cfb4..609e517 100644 --- a/test/test_checks.py +++ b/test/test_checks.py @@ -11,10 +11,6 @@ def test_get_noqa_lines(self): class TestFlake8Stdin(TestCase): - def setUp(self): - if not hasattr(self, 'assertRegex'): - self.assertRegex = self.assertRegexpMatches - def test_stdin(self): """Test using stdin.""" filepath = get_absolute_path('data/doubles.py')