summaryrefslogtreecommitdiffstats
path: root/Lib/json
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/json')
-rw-r--r--Lib/json/tests/test_decode.py6
-rw-r--r--Lib/json/tests/test_default.py2
-rw-r--r--Lib/json/tests/test_dump.py8
-rw-r--r--Lib/json/tests/test_encode_basestring_ascii.py2
-rw-r--r--Lib/json/tests/test_float.py14
-rw-r--r--Lib/json/tests/test_indent.py6
-rw-r--r--Lib/json/tests/test_pass1.py2
-rw-r--r--Lib/json/tests/test_pass2.py2
-rw-r--r--Lib/json/tests/test_pass3.py2
-rw-r--r--Lib/json/tests/test_recursion.py2
-rw-r--r--Lib/json/tests/test_scanstring.py44
-rw-r--r--Lib/json/tests/test_separators.py6
-rw-r--r--Lib/json/tests/test_speedups.py4
-rw-r--r--Lib/json/tests/test_unicode.py32
14 files changed, 66 insertions, 66 deletions
diff --git a/Lib/json/tests/test_decode.py b/Lib/json/tests/test_decode.py
index ca8f7b3..6afafe6 100644
--- a/Lib/json/tests/test_decode.py
+++ b/Lib/json/tests/test_decode.py
@@ -9,19 +9,19 @@ class TestDecode(TestCase):
def test_decimal(self):
rval = json.loads('1.1', parse_float=decimal.Decimal)
self.assertTrue(isinstance(rval, decimal.Decimal))
- self.assertEquals(rval, decimal.Decimal('1.1'))
+ self.assertEqual(rval, decimal.Decimal('1.1'))
def test_float(self):
rval = json.loads('1', parse_int=float)
self.assertTrue(isinstance(rval, float))
- self.assertEquals(rval, 1.0)
+ self.assertEqual(rval, 1.0)
def test_decoder_optimizations(self):
# Several optimizations were made that skip over calls to
# the whitespace regex, so this test is designed to try and
# exercise the uncommon cases. The array cases are already covered.
rval = json.loads('{ "key" : "value" , "k":"v" }')
- self.assertEquals(rval, {"key":"value", "k":"v"})
+ self.assertEqual(rval, {"key":"value", "k":"v"})
def test_object_pairs_hook(self):
s = '{"xkd":1, "kcw":2, "art":3, "hxm":4, "qrt":5, "pad":6, "hoy":7}'
diff --git a/Lib/json/tests/test_default.py b/Lib/json/tests/test_default.py
index 49f05ad..6a03eeb 100644
--- a/Lib/json/tests/test_default.py
+++ b/Lib/json/tests/test_default.py
@@ -4,6 +4,6 @@ import json
class TestDefault(TestCase):
def test_default(self):
- self.assertEquals(
+ self.assertEqual(
json.dumps(type, default=repr),
json.dumps(repr(type)))
diff --git a/Lib/json/tests/test_dump.py b/Lib/json/tests/test_dump.py
index 39875d5..89978e0 100644
--- a/Lib/json/tests/test_dump.py
+++ b/Lib/json/tests/test_dump.py
@@ -7,15 +7,15 @@ class TestDump(TestCase):
def test_dump(self):
sio = StringIO()
json.dump({}, sio)
- self.assertEquals(sio.getvalue(), '{}')
+ self.assertEqual(sio.getvalue(), '{}')
def test_dumps(self):
- self.assertEquals(json.dumps({}), '{}')
+ self.assertEqual(json.dumps({}), '{}')
def test_encode_truefalse(self):
- self.assertEquals(json.dumps(
+ self.assertEqual(json.dumps(
{True: False, False: True}, sort_keys=True),
'{"false": true, "true": false}')
- self.assertEquals(json.dumps(
+ self.assertEqual(json.dumps(
{2: 3.0, 4.0: 5L, False: 1, 6L: True}, sort_keys=True),
'{"false": 1, "2": 3.0, "4.0": 5, "6": true}')
diff --git a/Lib/json/tests/test_encode_basestring_ascii.py b/Lib/json/tests/test_encode_basestring_ascii.py
index 02889f0..0e50110 100644
--- a/Lib/json/tests/test_encode_basestring_ascii.py
+++ b/Lib/json/tests/test_encode_basestring_ascii.py
@@ -36,7 +36,7 @@ class TestEncodeBaseStringAscii(TestCase):
fname = encode_basestring_ascii.__name__
for input_string, expect in CASES:
result = encode_basestring_ascii(input_string)
- self.assertEquals(result, expect,
+ self.assertEqual(result, expect,
'{0!r} != {1!r} for {2}({3!r})'.format(
result, expect, fname, input_string))
diff --git a/Lib/json/tests/test_float.py b/Lib/json/tests/test_float.py
index 15e7913..ec0cad1 100644
--- a/Lib/json/tests/test_float.py
+++ b/Lib/json/tests/test_float.py
@@ -7,13 +7,13 @@ 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)
+ self.assertEqual(float(json.dumps(num)), num)
+ self.assertEqual(json.loads(json.dumps(num)), num)
+ self.assertEqual(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)
+ self.assertEqual(json.dumps(num), str(num))
+ self.assertEqual(int(json.dumps(num)), num)
+ self.assertEqual(json.loads(json.dumps(num)), num)
+ self.assertEqual(json.loads(unicode(json.dumps(num))), num)
diff --git a/Lib/json/tests/test_indent.py b/Lib/json/tests/test_indent.py
index 6055162..cd608d9 100644
--- a/Lib/json/tests/test_indent.py
+++ b/Lib/json/tests/test_indent.py
@@ -36,6 +36,6 @@ class TestIndent(TestCase):
h1 = json.loads(d1)
h2 = json.loads(d2)
- self.assertEquals(h1, h)
- self.assertEquals(h2, h)
- self.assertEquals(d2, expect)
+ self.assertEqual(h1, h)
+ self.assertEqual(h2, h)
+ self.assertEqual(d2, expect)
diff --git a/Lib/json/tests/test_pass1.py b/Lib/json/tests/test_pass1.py
index 216e252..719c113 100644
--- a/Lib/json/tests/test_pass1.py
+++ b/Lib/json/tests/test_pass1.py
@@ -67,7 +67,7 @@ class TestPass1(TestCase):
# test in/out equivalence and parsing
res = json.loads(JSON)
out = json.dumps(res)
- self.assertEquals(res, json.loads(out))
+ self.assertEqual(res, json.loads(out))
try:
json.dumps(res, allow_nan=False)
except ValueError:
diff --git a/Lib/json/tests/test_pass2.py b/Lib/json/tests/test_pass2.py
index 80d8433..379117e 100644
--- a/Lib/json/tests/test_pass2.py
+++ b/Lib/json/tests/test_pass2.py
@@ -11,4 +11,4 @@ class TestPass2(TestCase):
# test in/out equivalence and parsing
res = json.loads(JSON)
out = json.dumps(res)
- self.assertEquals(res, json.loads(out))
+ self.assertEqual(res, json.loads(out))
diff --git a/Lib/json/tests/test_pass3.py b/Lib/json/tests/test_pass3.py
index 77d87b2..9151c43 100644
--- a/Lib/json/tests/test_pass3.py
+++ b/Lib/json/tests/test_pass3.py
@@ -17,4 +17,4 @@ class TestPass3(TestCase):
# test in/out equivalence and parsing
res = json.loads(JSON)
out = json.dumps(res)
- self.assertEquals(res, json.loads(out))
+ self.assertEqual(res, json.loads(out))
diff --git a/Lib/json/tests/test_recursion.py b/Lib/json/tests/test_recursion.py
index 073d3c1..1e9b8ab 100644
--- a/Lib/json/tests/test_recursion.py
+++ b/Lib/json/tests/test_recursion.py
@@ -57,7 +57,7 @@ class TestRecursion(TestCase):
def test_defaultrecursion(self):
enc = RecursiveJSONEncoder()
- self.assertEquals(enc.encode(JSONTestObject), '"JSONTestObject"')
+ self.assertEqual(enc.encode(JSONTestObject), '"JSONTestObject"')
enc.recurse = True
try:
enc.encode(JSONTestObject)
diff --git a/Lib/json/tests/test_scanstring.py b/Lib/json/tests/test_scanstring.py
index 53d0b66..bf3ccd5 100644
--- a/Lib/json/tests/test_scanstring.py
+++ b/Lib/json/tests/test_scanstring.py
@@ -13,92 +13,92 @@ class TestScanString(TestCase):
self._test_scanstring(json.decoder.c_scanstring)
def _test_scanstring(self, scanstring):
- self.assertEquals(
+ self.assertEqual(
scanstring('"z\\ud834\\udd20x"', 1, None, True),
(u'z\U0001d120x', 16))
if sys.maxunicode == 65535:
- self.assertEquals(
+ self.assertEqual(
scanstring(u'"z\U0001d120x"', 1, None, True),
(u'z\U0001d120x', 6))
else:
- self.assertEquals(
+ self.assertEqual(
scanstring(u'"z\U0001d120x"', 1, None, True),
(u'z\U0001d120x', 5))
- self.assertEquals(
+ self.assertEqual(
scanstring('"\\u007b"', 1, None, True),
(u'{', 8))
- self.assertEquals(
+ self.assertEqual(
scanstring('"A JSON payload should be an object or array, not a string."', 1, None, True),
(u'A JSON payload should be an object or array, not a string.', 60))
- self.assertEquals(
+ self.assertEqual(
scanstring('["Unclosed array"', 2, None, True),
(u'Unclosed array', 17))
- self.assertEquals(
+ self.assertEqual(
scanstring('["extra comma",]', 2, None, True),
(u'extra comma', 14))
- self.assertEquals(
+ self.assertEqual(
scanstring('["double extra comma",,]', 2, None, True),
(u'double extra comma', 21))
- self.assertEquals(
+ self.assertEqual(
scanstring('["Comma after the close"],', 2, None, True),
(u'Comma after the close', 24))
- self.assertEquals(
+ self.assertEqual(
scanstring('["Extra close"]]', 2, None, True),
(u'Extra close', 14))
- self.assertEquals(
+ self.assertEqual(
scanstring('{"Extra comma": true,}', 2, None, True),
(u'Extra comma', 14))
- self.assertEquals(
+ self.assertEqual(
scanstring('{"Extra value after close": true} "misplaced quoted value"', 2, None, True),
(u'Extra value after close', 26))
- self.assertEquals(
+ self.assertEqual(
scanstring('{"Illegal expression": 1 + 2}', 2, None, True),
(u'Illegal expression', 21))
- self.assertEquals(
+ self.assertEqual(
scanstring('{"Illegal invocation": alert()}', 2, None, True),
(u'Illegal invocation', 21))
- self.assertEquals(
+ self.assertEqual(
scanstring('{"Numbers cannot have leading zeroes": 013}', 2, None, True),
(u'Numbers cannot have leading zeroes', 37))
- self.assertEquals(
+ self.assertEqual(
scanstring('{"Numbers cannot be hex": 0x14}', 2, None, True),
(u'Numbers cannot be hex', 24))
- self.assertEquals(
+ self.assertEqual(
scanstring('[[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]]', 21, None, True),
(u'Too deep', 30))
- self.assertEquals(
+ self.assertEqual(
scanstring('{"Missing colon" null}', 2, None, True),
(u'Missing colon', 16))
- self.assertEquals(
+ self.assertEqual(
scanstring('{"Double colon":: null}', 2, None, True),
(u'Double colon', 15))
- self.assertEquals(
+ self.assertEqual(
scanstring('{"Comma instead of colon", null}', 2, None, True),
(u'Comma instead of colon', 25))
- self.assertEquals(
+ self.assertEqual(
scanstring('["Colon instead of comma": false]', 2, None, True),
(u'Colon instead of comma', 25))
- self.assertEquals(
+ self.assertEqual(
scanstring('["Bad value", truth]', 2, None, True),
(u'Bad value', 12))
diff --git a/Lib/json/tests/test_separators.py b/Lib/json/tests/test_separators.py
index 32db341..d5b92bd 100644
--- a/Lib/json/tests/test_separators.py
+++ b/Lib/json/tests/test_separators.py
@@ -37,6 +37,6 @@ class TestSeparators(TestCase):
h1 = json.loads(d1)
h2 = json.loads(d2)
- self.assertEquals(h1, h)
- self.assertEquals(h2, h)
- self.assertEquals(d2, expect)
+ self.assertEqual(h1, h)
+ self.assertEqual(h2, h)
+ self.assertEqual(d2, expect)
diff --git a/Lib/json/tests/test_speedups.py b/Lib/json/tests/test_speedups.py
index 3f8c108..3b4ccb3 100644
--- a/Lib/json/tests/test_speedups.py
+++ b/Lib/json/tests/test_speedups.py
@@ -5,11 +5,11 @@ from json import decoder, encoder, scanner
class TestSpeedups(TestCase):
def test_scanstring(self):
- self.assertEquals(decoder.scanstring.__module__, "_json")
+ self.assertEqual(decoder.scanstring.__module__, "_json")
self.assertTrue(decoder.scanstring is decoder.c_scanstring)
def test_encode_basestring_ascii(self):
- self.assertEquals(encoder.encode_basestring_ascii.__module__, "_json")
+ self.assertEqual(encoder.encode_basestring_ascii.__module__, "_json")
self.assertTrue(encoder.encode_basestring_ascii is
encoder.c_encode_basestring_ascii)
diff --git a/Lib/json/tests/test_unicode.py b/Lib/json/tests/test_unicode.py
index 6aaed3f..ad7fe24 100644
--- a/Lib/json/tests/test_unicode.py
+++ b/Lib/json/tests/test_unicode.py
@@ -10,50 +10,50 @@ class TestUnicode(TestCase):
s = u.encode('utf-8')
ju = encoder.encode(u)
js = encoder.encode(s)
- self.assertEquals(ju, js)
+ self.assertEqual(ju, js)
def test_encoding2(self):
u = u'\N{GREEK SMALL LETTER ALPHA}\N{GREEK CAPITAL LETTER OMEGA}'
s = u.encode('utf-8')
ju = json.dumps(u, encoding='utf-8')
js = json.dumps(s, encoding='utf-8')
- self.assertEquals(ju, js)
+ self.assertEqual(ju, js)
def test_encoding3(self):
u = u'\N{GREEK SMALL LETTER ALPHA}\N{GREEK CAPITAL LETTER OMEGA}'
j = json.dumps(u)
- self.assertEquals(j, '"\\u03b1\\u03a9"')
+ self.assertEqual(j, '"\\u03b1\\u03a9"')
def test_encoding4(self):
u = u'\N{GREEK SMALL LETTER ALPHA}\N{GREEK CAPITAL LETTER OMEGA}'
j = json.dumps([u])
- self.assertEquals(j, '["\\u03b1\\u03a9"]')
+ self.assertEqual(j, '["\\u03b1\\u03a9"]')
def test_encoding5(self):
u = u'\N{GREEK SMALL LETTER ALPHA}\N{GREEK CAPITAL LETTER OMEGA}'
j = json.dumps(u, ensure_ascii=False)
- self.assertEquals(j, u'"{0}"'.format(u))
+ self.assertEqual(j, u'"{0}"'.format(u))
def test_encoding6(self):
u = u'\N{GREEK SMALL LETTER ALPHA}\N{GREEK CAPITAL LETTER OMEGA}'
j = json.dumps([u], ensure_ascii=False)
- self.assertEquals(j, u'["{0}"]'.format(u))
+ self.assertEqual(j, u'["{0}"]'.format(u))
def test_big_unicode_encode(self):
u = u'\U0001d120'
- self.assertEquals(json.dumps(u), '"\\ud834\\udd20"')
- self.assertEquals(json.dumps(u, ensure_ascii=False), u'"\U0001d120"')
+ self.assertEqual(json.dumps(u), '"\\ud834\\udd20"')
+ self.assertEqual(json.dumps(u, ensure_ascii=False), u'"\U0001d120"')
def test_big_unicode_decode(self):
u = u'z\U0001d120x'
- self.assertEquals(json.loads('"' + u + '"'), u)
- self.assertEquals(json.loads('"z\\ud834\\udd20x"'), u)
+ self.assertEqual(json.loads('"' + u + '"'), u)
+ self.assertEqual(json.loads('"z\\ud834\\udd20x"'), u)
def test_unicode_decode(self):
for i in range(0, 0xd7ff):
u = unichr(i)
s = '"\\u{0:04x}"'.format(i)
- self.assertEquals(json.loads(s), u)
+ self.assertEqual(json.loads(s), u)
def test_object_pairs_hook_with_unicode(self):
s = u'{"xkd":1, "kcw":2, "art":3, "hxm":4, "qrt":5, "pad":6, "hoy":7}'
@@ -71,12 +71,12 @@ class TestUnicode(TestCase):
OrderedDict(p))
def test_default_encoding(self):
- self.assertEquals(json.loads(u'{"a": "\xe9"}'.encode('utf-8')),
+ self.assertEqual(json.loads(u'{"a": "\xe9"}'.encode('utf-8')),
{'a': u'\xe9'})
def test_unicode_preservation(self):
- self.assertEquals(type(json.loads(u'""')), unicode)
- self.assertEquals(type(json.loads(u'"a"')), unicode)
- self.assertEquals(type(json.loads(u'["a"]')[0]), unicode)
+ self.assertEqual(type(json.loads(u'""')), unicode)
+ self.assertEqual(type(json.loads(u'"a"')), unicode)
+ self.assertEqual(type(json.loads(u'["a"]')[0]), unicode)
# Issue 10038.
- self.assertEquals(type(json.loads('"foo"')), unicode)
+ self.assertEqual(type(json.loads('"foo"')), unicode)