diff --git a/src/_pytest/doctest.py b/src/_pytest/doctest.py index 0784f431b..7d37be2ac 100644 --- a/src/_pytest/doctest.py +++ b/src/_pytest/doctest.py @@ -656,7 +656,7 @@ def _init_checker_class() -> Type["doctest.OutputChecker"]: precision = 0 if fraction is None else len(fraction) if exponent is not None: precision -= int(exponent) - if float(w.group()) == approx(float(g.group()), abs=10 ** -precision): + if float(w.group()) == approx(float(g.group()), abs=10**-precision): # They're close enough. Replace the text we actually # got with the text we want, so that it will match when we # check the string literally. diff --git a/testing/io/test_terminalwriter.py b/testing/io/test_terminalwriter.py index 4866c94a5..6fe718b53 100644 --- a/testing/io/test_terminalwriter.py +++ b/testing/io/test_terminalwriter.py @@ -56,7 +56,7 @@ def test_terminalwriter_not_unicode() -> None: file = io.TextIOWrapper(buffer, encoding="cp1252") tw = terminalwriter.TerminalWriter(file) tw.write("hello 🌀 wôrld אבג", flush=True) - assert buffer.getvalue() == br"hello \U0001f300 w\xf4rld \u05d0\u05d1\u05d2" + assert buffer.getvalue() == rb"hello \U0001f300 w\xf4rld \u05d0\u05d1\u05d2" win32 = int(sys.platform == "win32") diff --git a/testing/python/approx.py b/testing/python/approx.py index f417a5992..eb9bcd874 100644 --- a/testing/python/approx.py +++ b/testing/python/approx.py @@ -771,7 +771,7 @@ class TestApprox: def test_expected_value_type_error(self, x, name): with pytest.raises( TypeError, - match=fr"pytest.approx\(\) does not support nested {name}:", + match=rf"pytest.approx\(\) does not support nested {name}:", ): approx(x) diff --git a/testing/test_assertrewrite.py b/testing/test_assertrewrite.py index dd1573935..ae18b4be3 100644 --- a/testing/test_assertrewrite.py +++ b/testing/test_assertrewrite.py @@ -1313,7 +1313,7 @@ class TestIssue2121: @pytest.mark.skipif( - sys.maxsize <= (2 ** 31 - 1), reason="Causes OverflowError on 32bit systems" + sys.maxsize <= (2**31 - 1), reason="Causes OverflowError on 32bit systems" ) @pytest.mark.parametrize("offset", [-1, +1]) def test_source_mtime_long_long(pytester: Pytester, offset) -> None: @@ -1332,7 +1332,7 @@ def test_source_mtime_long_long(pytester: Pytester, offset) -> None: # use unsigned long timestamp which overflows signed long, # which was the cause of the bug # +1 offset also tests masking of 0xFFFFFFFF - timestamp = 2 ** 32 + offset + timestamp = 2**32 + offset os.utime(str(p), (timestamp, timestamp)) result = pytester.runpytest() assert result.ret == 0