diff options
| author | Alexander Belopolsky <alexander.belopolsky@gmail.com> | 2010-11-30 03:03:30 (GMT) | 
|---|---|---|
| committer | Alexander Belopolsky <alexander.belopolsky@gmail.com> | 2010-11-30 03:03:30 (GMT) | 
| commit | ff27ee0b400030419cfd3c9966f275bfbcb569f8 (patch) | |
| tree | c2e45325768bd5256432667c387f304d549493e6 /Lib/test/json_tests/test_float.py | |
| parent | 69b34bfe9c3e5da1d7336a607ab56f1c3a178dca (diff) | |
| download | cpython-ff27ee0b400030419cfd3c9966f275bfbcb569f8.zip cpython-ff27ee0b400030419cfd3c9966f275bfbcb569f8.tar.gz cpython-ff27ee0b400030419cfd3c9966f275bfbcb569f8.tar.bz2  | |
Issue #10572: Moved json tests to Lib/test/json_tests.
Approved by Raymond Hettinger.
Diffstat (limited to 'Lib/test/json_tests/test_float.py')
| -rw-r--r-- | Lib/test/json_tests/test_float.py | 15 | 
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/test/json_tests/test_float.py b/Lib/test/json_tests/test_float.py new file mode 100644 index 0000000..ca4a506 --- /dev/null +++ b/Lib/test/json_tests/test_float.py @@ -0,0 +1,15 @@ +import math +from unittest import TestCase + +import json + +class TestFloat(TestCase): +    def test_floats(self): +        for num in [1617161771.7650001, math.pi, math.pi**100, math.pi**-100, 3.1]: +            self.assertEqual(float(json.dumps(num)), num) +            self.assertEqual(json.loads(json.dumps(num)), num) + +    def test_ints(self): +        for num in [1, 1<<32, 1<<64]: +            self.assertEqual(json.dumps(num), str(num)) +            self.assertEqual(int(json.dumps(num)), num)  | 
