diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2024-01-29 17:58:31 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-29 17:58:31 (GMT) |
commit | aa3402ad451777d8dd3ec560e14cb16dc8540c0e (patch) | |
tree | 4ebbaed141835815f133a62cfa4e921e708b29e7 /Lib/test/test_decimal.py | |
parent | 0cd9bacb8ad41fe86f95b326e9199caa749539eb (diff) | |
download | cpython-aa3402ad451777d8dd3ec560e14cb16dc8540c0e.zip cpython-aa3402ad451777d8dd3ec560e14cb16dc8540c0e.tar.gz cpython-aa3402ad451777d8dd3ec560e14cb16dc8540c0e.tar.bz2 |
gh-114678: Fix incorrect deprecation warning for 'N' specifier in Decimal format (GH-114683)
Co-authored-by: Stefan Krah <skrah@bytereef.org>
Diffstat (limited to 'Lib/test/test_decimal.py')
-rw-r--r-- | Lib/test/test_decimal.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/Lib/test/test_decimal.py b/Lib/test/test_decimal.py index 7a5fe62..1423bc6 100644 --- a/Lib/test/test_decimal.py +++ b/Lib/test/test_decimal.py @@ -41,6 +41,7 @@ from test.support import (TestFailed, darwin_malloc_err_warning, is_emscripten) from test.support.import_helper import import_fresh_module from test.support import threading_helper +from test.support import warnings_helper import random import inspect import threading @@ -1237,7 +1238,14 @@ class FormatTest: else: self.assertRaises(ValueError, format, h, 'N') self.assertRaises(ValueError, format, h, '010.3N') - + with warnings_helper.check_no_warnings(self): + self.assertEqual(format(h, 'N>10.3'), 'NN6.63E-34') + self.assertEqual(format(h, 'N>10.3n'), 'NN6.63e-34') + self.assertEqual(format(h, 'N>10.3e'), 'N6.626e-34') + self.assertEqual(format(h, 'N>10.3f'), 'NNNNN0.000') + self.assertRaises(ValueError, format, h, '>Nf') + self.assertRaises(ValueError, format, h, '10Nf') + self.assertRaises(ValueError, format, h, 'Nx') @run_with_locale('LC_ALL', 'ps_AF') def test_wide_char_separator_decimal_point(self): |