diff options
author | Eric Smith <eric@trueblade.com> | 2010-02-22 14:58:30 (GMT) |
---|---|---|
committer | Eric Smith <eric@trueblade.com> | 2010-02-22 14:58:30 (GMT) |
commit | 68af50ba392daee56ac555a1b292197b62a0e52c (patch) | |
tree | 9a74b1ee227ae4a872c05aac7135164f7df2efa9 /Lib | |
parent | 9d2d327963fac62294c20fb4611071a30a609293 (diff) | |
download | cpython-68af50ba392daee56ac555a1b292197b62a0e52c.zip cpython-68af50ba392daee56ac555a1b292197b62a0e52c.tar.gz cpython-68af50ba392daee56ac555a1b292197b62a0e52c.tar.bz2 |
Issue #5988: Delete deprecated functions PyOS_ascii_formatd, PyOS_ascii_strtod, and PyOS_ascii_atof.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_ascii_formatd.py | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/Lib/test/test_ascii_formatd.py b/Lib/test/test_ascii_formatd.py deleted file mode 100644 index f61bc85..0000000 --- a/Lib/test/test_ascii_formatd.py +++ /dev/null @@ -1,61 +0,0 @@ -# PyOS_ascii_formatd is deprecated and not called from anywhere in -# Python itself. So this module is the only place it gets tested. -# Test that it works, and test that it's deprecated. - -import unittest -from test.support import check_warnings, run_unittest, cpython_only - -class FormatDeprecationTests(unittest.TestCase): - - @cpython_only - def testFormatDeprecation(self): - # delay importing ctypes until we know we're in CPython - from ctypes import (pythonapi, create_string_buffer, sizeof, byref, - c_double) - PyOS_ascii_formatd = pythonapi.PyOS_ascii_formatd - buf = create_string_buffer(100) - - with check_warnings() as w: - PyOS_ascii_formatd(byref(buf), sizeof(buf), b'%+.10f', - c_double(10.0)) - self.assertEqual(buf.value, b'+10.0000000000') - - self.assertEqual(w.category, DeprecationWarning) - -class FormatTests(unittest.TestCase): - # ensure that, for the restricted set of format codes, - # %-formatting returns the same values os PyOS_ascii_formatd - @cpython_only - def testFormat(self): - # delay importing ctypes until we know we're in CPython - from ctypes import (pythonapi, create_string_buffer, sizeof, byref, - c_double) - PyOS_ascii_formatd = pythonapi.PyOS_ascii_formatd - buf = create_string_buffer(100) - - tests = [ - ('%f', 100.0), - ('%g', 100.0), - ('%#g', 100.0), - ('%#.2g', 100.0), - ('%#.2g', 123.4567), - ('%#.2g', 1.234567e200), - ('%e', 1.234567e200), - ('%e', 1.234), - ('%+e', 1.234), - ('%-e', 1.234), - ] - - with check_warnings(): - for format, val in tests: - PyOS_ascii_formatd(byref(buf), sizeof(buf), - bytes(format, 'ascii'), - c_double(val)) - self.assertEqual(buf.value, bytes(format % val, 'ascii')) - - -def test_main(): - run_unittest(FormatDeprecationTests, FormatTests) - -if __name__ == '__main__': - test_main() |