FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-85989: move HAVE_DOUBLE_ROUNDING check to test.support by skirpichev · Pull Request #150219 · python/cpython · GitHub

Repository navigation

Prev Previous commit
Next Next commit
address review: rename decorator
  • Loading branch information
skirpichev committed May 26, 2026
commit dd5edc3df79c5c4e7ea1bbf2dd39a8dbc772f193
9 changes: 4 additions & 5 deletions Lib/test/support/__init__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"run_no_yield_async_fn", "run_yielding_async_fn", "async_yield",
"reset_code", "on_github_actions",
"requires_root_user", "requires_non_root_user",
"skip_if_have_double_rounding",
"skip_if_double_rounding",
]


Expand Down Expand Up @@ -527,10 +527,9 @@ def dec(*args, **kwargs):

# detect evidence of double-rounding:
x, y = 1e16, 2.9999 # use temporary values to defeat peephole optimizer
skip_if_have_double_rounding = unittest.skipIf(x + y == 1e16 + 4,
("accuracy not guaranteed on "
"machines with double "
"rounding"))
skip_if_double_rounding = unittest.skipIf(x + y == 1e16 + 4,
("accuracy not guaranteed on "
"machines with double rounding"))
Comment thread
skirpichev marked this conversation as resolved.
Outdated


def requires_zlib(reason='requires zlib'):
Expand Down
4 changes: 2 additions & 2 deletions Lib/test/test_builtin.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
from test.support.script_helper import assert_python_ok
from test.support.testcase import ComplexesAreIdenticalMixin
from test.support.warnings_helper import check_warnings
from test.support import requires_IEEE_754, skip_if_have_double_rounding
from test.support import requires_IEEE_754, skip_if_double_rounding
from unittest.mock import MagicMock, patch
try:
import pty, signal
Expand Down Expand Up @@ -2230,7 +2230,7 @@ def __getitem__(self, index):
complex(2, -0.0))

@requires_IEEE_754
@skip_if_have_double_rounding
@skip_if_double_rounding
@support.cpython_only # Other implementations may choose a different algorithm
def test_sum_accuracy(self):
self.assertEqual(sum([0.1] * 10), 1.0)
Expand Down
10 changes: 5 additions & 5 deletions Lib/test/test_math.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# XXXX Should not do tests around zero only

from test.support import (verbose, requires_IEEE_754,
skip_if_have_double_rounding)
skip_if_double_rounding)
from test import support
import unittest
import fractions
Expand Down Expand Up @@ -679,7 +679,7 @@ def testfrexp(name, result, expected):
self.assertTrue(math.isnan(math.frexp(NAN)[0]))

@requires_IEEE_754
@skip_if_have_double_rounding
@skip_if_double_rounding
def testFsum(self):
# math.fsum relies on exact rounding for correct operation.
# There's a known problem with IA32 floating-point that causes
Expand Down Expand Up @@ -915,7 +915,7 @@ def testHypot(self):
self.assertRaises(TypeError, math.hypot, *([1.0]*18), 'spam')

@requires_IEEE_754
@skip_if_have_double_rounding
@skip_if_double_rounding
def testHypotAccuracy(self):
# Verify improved accuracy in cases that were known to be inaccurate.
#
Expand Down Expand Up @@ -1404,7 +1404,7 @@ def __rmul__(self, other):
self.assertEqual(sumprod(*args), 0.0)

@requires_IEEE_754
@skip_if_have_double_rounding
@skip_if_double_rounding
@support.cpython_only # Other implementations may choose a different algorithm
def test_sumprod_accuracy(self):
sumprod = math.sumprod
Expand Down Expand Up @@ -1489,7 +1489,7 @@ def run(func, *args):
)

@requires_IEEE_754
@skip_if_have_double_rounding
@skip_if_double_rounding
@support.cpython_only # Other implementations may choose a different algorithm
@support.requires_resource('cpu')
def test_sumprod_extended_precision_accuracy(self):
Expand Down
4 changes: 2 additions & 2 deletions Lib/test/test_statistics.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import unittest
from test import support
from test.support import (import_helper, requires_IEEE_754,
skip_if_have_double_rounding)
skip_if_double_rounding)

from decimal import Decimal
from fractions import Fraction
Expand Down Expand Up @@ -2791,7 +2791,7 @@ def test_sqrtprod_helper_function_fundamentals(self):
self.assertEqual(sign(actual), sign(expected))

@requires_IEEE_754
@skip_if_have_double_rounding
@skip_if_double_rounding
@support.cpython_only # Allow for a weaker sumprod() implementation
def test_sqrtprod_helper_function_improved_accuracy(self):
# Test a known example where accuracy is improved
Expand Down
Loading

Back | FazBrowse Home | New Git URL