Author: Ronan Lamy <ronan.l...@gmail.com>
Branch: py3.5
Changeset: r93407:3c274e0f1720
Date: 2017-12-13 21:51 +0000
http://bitbucket.org/pypy/pypy/changeset/3c274e0f1720/

Log:    Port extra_tests/test_json.py to py3

diff --git a/extra_tests/test_json.py b/extra_tests/test_json.py
--- a/extra_tests/test_json.py
+++ b/extra_tests/test_json.py
@@ -7,15 +7,11 @@
 
 def test_no_ensure_ascii():
     assert is_(json.dumps(u"\u1234", ensure_ascii=False), u'"\u1234"')
-    assert is_(json.dumps("\xc0", ensure_ascii=False), '"\xc0"')
-    with pytest.raises(UnicodeDecodeError) as excinfo:
-        json.dumps((u"\u1234", "\xc0"), ensure_ascii=False)
-    assert str(excinfo.value).startswith(
-        "'ascii' codec can't decode byte 0xc0 ")
-    with pytest.raises(UnicodeDecodeError) as excinfo:
-        json.dumps(("\xc0", u"\u1234"), ensure_ascii=False)
-    assert str(excinfo.value).startswith(
-        "'ascii' codec can't decode byte 0xc0 ")
+    assert is_(json.dumps(u"\xc0", ensure_ascii=False), u'"\xc0"')
+    with pytest.raises(TypeError):
+        json.dumps((u"\u1234", b"x"), ensure_ascii=False)
+    with pytest.raises(TypeError):
+        json.dumps((b"x", u"\u1234"), ensure_ascii=False)
 
 def test_issue2191():
     assert is_(json.dumps(u"xxx", ensure_ascii=False), u'"xxx"')
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to