summaryrefslogtreecommitdiff
path: root/simplejson/tests/test_float.py
diff options
context:
space:
mode:
authorBob Ippolito <bob@redivi.com>2012-12-29 12:41:55 -0800
committerBob Ippolito <bob@redivi.com>2012-12-29 12:41:55 -0800
commit16ae2381fc14d4e91fa3af5d82e01eda6929572e (patch)
tree4e5c2554bc5083a1a107e706050e99121e35a759 /simplejson/tests/test_float.py
parent83a493db6a8b859ec7b10fa85365dd3fdf144c68 (diff)
downloadsimplejson-16ae2381fc14d4e91fa3af5d82e01eda6929572e.tar.gz
more coverage, decimal key coercion
Diffstat (limited to 'simplejson/tests/test_float.py')
-rw-r--r--simplejson/tests/test_float.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/simplejson/tests/test_float.py b/simplejson/tests/test_float.py
index f7e29d6..5d50223 100644
--- a/simplejson/tests/test_float.py
+++ b/simplejson/tests/test_float.py
@@ -2,8 +2,16 @@ import math
from unittest import TestCase
from simplejson.compat import long_type, text_type
import simplejson as json
+from simplejson.decoder import NaN, PosInf, NegInf
class TestFloat(TestCase):
+ def test_degenerates(self):
+ for inf in (PosInf, NegInf):
+ self.assertEquals(json.loads(json.dumps(inf)), inf)
+ # Python 2.5 doesn't have math.isnan
+ nan = json.loads(json.dumps(NaN))
+ self.assert_((0 + nan) != nan)
+
def test_floats(self):
for num in [1617161771.7650001, math.pi, math.pi**100,
math.pi**-100, 3.1]: