File fix-test_check_nullbytes.patch of Package python-pycodestyle.38238

---
 testsuite/test_api.py |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Index: pycodestyle-2.5.0/testsuite/test_api.py
===================================================================
--- pycodestyle-2.5.0.orig/testsuite/test_api.py	2019-01-29 14:46:14.000000000 +0100
+++ pycodestyle-2.5.0/testsuite/test_api.py	2025-03-31 22:24:22.912378059 +0200
@@ -339,6 +339,7 @@
         self.assertEqual(count_errors, 0)
 
     def test_check_nullbytes(self):
+        import re
         pycodestyle.register_check(DummyChecker, ['Z701'])
 
         pep8style = pycodestyle.StyleGuide()
@@ -347,13 +348,13 @@
         stdout = sys.stdout.getvalue()
         if 'SyntaxError' in stdout:
             # PyPy 2.2 returns a SyntaxError
-            expected = "stdin:1:2: E901 SyntaxError"
+            expected = "stdin:1:[1-2]: E901 SyntaxError"
         elif 'ValueError' in stdout:
             # Python 3.5.
             expected = "stdin:1:1: E901 ValueError"
         else:
             expected = "stdin:1:1: E901 TypeError"
-        self.assertTrue(stdout.startswith(expected),
+        self.assertTrue(re.match(expected, stdout) is not None,
                         msg='Output %r does not start with %r' %
                         (stdout, expected))
         self.assertFalse(sys.stderr)
openSUSE Build Service is sponsored by