| author | John Kern <johnk@symbian.org> |
| Mon, 14 Dec 2009 08:59:54 -0800 | |
| changeset 26 | ba5cb42d7f02 |
| parent 1 | 2fb8b9db1c86 |
| permissions | -rw-r--r-- |
import decimal from unittest import TestCase import json class TestDecode(TestCase): def test_decimal(self): rval = json.loads('1.1', parse_float=decimal.Decimal) self.assert_(isinstance(rval, decimal.Decimal)) self.assertEquals(rval, decimal.Decimal('1.1')) def test_float(self): rval = json.loads('1', parse_int=float) self.assert_(isinstance(rval, float)) self.assertEquals(rval, 1.0)