Skip tests for g/G format types in CPython 3.8
$ python3.9
Python 3.9.19+ (heads/3.9:3f5d9d12c7, Aug 29 2024, 13:17:09)
[GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> format(240605919345005.0, '.14g')
'2.40605919345e+14'
$ python3.8
Python 3.8.19+ (heads/3.8:e319f774f9, Aug 29 2024, 12:59:09)
[GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> format(240605919345005.0, '.14g')
'2.4060591934500e+14'
This commit is contained in:
@@ -477,6 +477,8 @@ def test_mpf_floats_bulk(fmt, x):
|
||||
if not x and math.copysign(1, x) == -1:
|
||||
return # skip negative zero
|
||||
spec = read_format_spec(fmt)
|
||||
if sys.version_info < (3, 9) and spec['type'] in ('g', 'G'):
|
||||
pytest.skip("CPython has incompatible g/G formatting in 3.8 and 3.9+")
|
||||
if not spec['type'] and spec['precision'] < 0 and math.isfinite(x):
|
||||
# The mpmath could choose a different decimal
|
||||
# representative (wrt CPython) for same binary
|
||||
@@ -498,6 +500,8 @@ def test_mpc_complexes(fmt, z):
|
||||
or (not z.imag and math.copysign(1, z.imag) == -1)):
|
||||
return # skip negative zero
|
||||
spec = read_format_spec(fmt)
|
||||
if sys.version_info < (3, 9) and spec['type'] in ('g', 'G'):
|
||||
pytest.skip("CPython has incompatible g/G formatting in 3.8 and 3.9+")
|
||||
if spec['precision'] < 0 and any(math.isfinite(_) for _ in [z.real, z.imag]):
|
||||
# The mpmath could choose a different decimal
|
||||
# representative (wrt CPython) for same binary
|
||||
|
||||
Reference in New Issue
Block a user