Sha256: 4c7f83af17d916c3dfdc1e464c18711dba73920d45f9a101903e162e31bdbf7b

Contents?: true

Size: 743 Bytes

Versions: 33

Compression:

Stored size: 743 Bytes

Contents

import math
from unittest import TestCase

import simplejson as json

class TestFloat(TestCase):
    def test_floats(self):
        for num in [1617161771.7650001, math.pi, math.pi**100,
                    math.pi**-100, 3.1]:
            self.assertEquals(float(json.dumps(num)), num)
            self.assertEquals(json.loads(json.dumps(num)), num)
            self.assertEquals(json.loads(unicode(json.dumps(num))), num)

    def test_ints(self):
        for num in [1, 1L, 1<<32, 1<<64]:
            self.assertEquals(json.dumps(num), str(num))
            self.assertEquals(int(json.dumps(num)), num)
            self.assertEquals(json.loads(json.dumps(num)), num)
            self.assertEquals(json.loads(unicode(json.dumps(num))), num)

Version data entries

33 entries across 33 versions & 5 rubygems

Version Path
pygments.rb-1.2.1 vendor/simplejson/simplejson/tests/test_float.py
pygments.rb-1.2.0 vendor/simplejson/simplejson/tests/test_float.py
pygments.rb-1.1.2 vendor/simplejson/simplejson/tests/test_float.py
pygments.rb-1.1.1 vendor/simplejson/simplejson/tests/test_float.py
pygments.rb-1.1.0 vendor/simplejson/simplejson/tests/test_float.py
pygments.rb-1.0.0 vendor/simplejson/simplejson/tests/test_float.py
tdiary-4.2.1 vendor/bundle/ruby/2.2.0/gems/pygments.rb-0.6.3/vendor/simplejson/simplejson/tests/test_float.py
pygments.rb-0.6.3 vendor/simplejson/simplejson/tests/test_float.py
pygments.rb-0.6.2 vendor/simplejson/simplejson/tests/test_float.py
pygments.rb-0.6.1 vendor/simplejson/simplejson/tests/test_float.py
pygments.rb-0.6.0 vendor/simplejson/simplejson/tests/test_float.py
mortar-pygments.rb-0.5.7 vendor/simplejson/simplejson/tests/test_float.py
mortar-pygments.rb-0.5.6 vendor/simplejson/simplejson/tests/test_float.py
mortar-pygments.rb-0.5.5 vendor/simplejson/simplejson/tests/test_float.py
pygments.rb-jruby-0.5.4.2 vendor/simplejson/simplejson/tests/test_float.py
pygments.rb-jruby-0.5.4.1 vendor/simplejson/simplejson/tests/test_float.py
pygments.rb-jruby-0.5.4 vendor/simplejson/simplejson/tests/test_float.py
gitlab-pygments.rb-0.5.4 vendor/simplejson/simplejson/tests/test_float.py
pygments.rb-0.5.4 vendor/simplejson/simplejson/tests/test_float.py
pygments.rb-0.5.2 vendor/simplejson/simplejson/tests/test_float.py