summaryrefslogtreecommitdiff
path: root/simplejson/tests
diff options
context:
space:
mode:
authorBob Ippolito <bob@redivi.com>2014-05-22 11:56:02 -0700
committerBob Ippolito <bob@redivi.com>2014-05-22 11:56:02 -0700
commit1c0ea7f4d3c85cee6904b312922fd50e24e08e78 (patch)
treea7516126de20b38d8dba61cf8f24a23bb6a29988 /simplejson/tests
parent28f1c547909102d2476cca8596f2eac4a7193b65 (diff)
downloadsimplejson-1c0ea7f4d3c85cee6904b312922fd50e24e08e78.tar.gz
consistently reject int_as_string_bitcount <= 0 #96v3.5.1
Diffstat (limited to 'simplejson/tests')
-rw-r--r--simplejson/tests/__init__.py1
-rw-r--r--simplejson/tests/test_bitsize_int_as_string.py6
2 files changed, 7 insertions, 0 deletions
diff --git a/simplejson/tests/__init__.py b/simplejson/tests/__init__.py
index 5490584..c7551e8 100644
--- a/simplejson/tests/__init__.py
+++ b/simplejson/tests/__init__.py
@@ -37,6 +37,7 @@ def all_tests_suite():
def get_suite():
return additional_tests(
unittest.TestLoader().loadTestsFromNames([
+ 'simplejson.tests.test_bitsize_int_as_string',
'simplejson.tests.test_bigint_as_string',
'simplejson.tests.test_check_circular',
'simplejson.tests.test_decode',
diff --git a/simplejson/tests/test_bitsize_int_as_string.py b/simplejson/tests/test_bitsize_int_as_string.py
index 7bb4d2c..fd7d103 100644
--- a/simplejson/tests/test_bitsize_int_as_string.py
+++ b/simplejson/tests/test_bitsize_int_as_string.py
@@ -17,6 +17,12 @@ class TestBitSizeIntAsString(TestCase):
((-1 << 31) + 1, (-1 << 31) + 1),
]
+ def test_invalid_counts(self):
+ for n in ['foo', -1, 0, 1.0]:
+ self.assertRaises(
+ TypeError,
+ json.dumps, 0, int_as_string_bitcount=n)
+
def test_ints_outside_range_fails(self):
self.assertNotEqual(
str(1 << 15),