~ubuntu-branches/ubuntu/oneiric/lightning-extension/oneiric-updates

« back to all changes in this revision

Viewing changes to mozilla/other-licenses/simplejson-2.1.1/simplejson/tests/test_float.py

  • Committer: Package Import Robot
  • Author(s): Chris Coulson
  • Date: 2012-11-08 10:00:06 UTC
  • mfrom: (1.3.8)
  • Revision ID: package-import@ubuntu.com-20121108100006-xpf89hktfitzuqc3
Tags: 1.9+build1-0ubuntu0.11.10.1
* New upstream stable release to support Thunderbird 17 (CALENDAR_1_9_BUILD1)
  - see LP: #1080212 for USN information

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
import math
2
 
from unittest import TestCase
3
 
 
4
 
import simplejson as json
5
 
 
6
 
class TestFloat(TestCase):
7
 
    def test_floats(self):
8
 
        for num in [1617161771.7650001, math.pi, math.pi**100,
9
 
                    math.pi**-100, 3.1]:
10
 
            self.assertEquals(float(json.dumps(num)), num)
11
 
            self.assertEquals(json.loads(json.dumps(num)), num)
12
 
            self.assertEquals(json.loads(unicode(json.dumps(num))), num)
13
 
 
14
 
    def test_ints(self):
15
 
        for num in [1, 1L, 1<<32, 1<<64]:
16
 
            self.assertEquals(json.dumps(num), str(num))
17
 
            self.assertEquals(int(json.dumps(num)), num)
18
 
            self.assertEquals(json.loads(json.dumps(num)), num)
19
 
            self.assertEquals(json.loads(unicode(json.dumps(num))), num)