aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRonan Lamy <ronan.lamy@gmail.com>2017-12-12 18:22:58 +0000
committerRonan Lamy <ronan.lamy@gmail.com>2017-12-12 18:22:58 +0000
commit26b955e91fe91ecfe6bec7db8db2590184d2312c (patch)
treebd2d765aaa9f7b248cf3fe8c0d40896b093359c5
parentmerge rdict-fast-hash: (diff)
downloadpypy-26b955e91fe91ecfe6bec7db8db2590184d2312c.tar.gz
pypy-26b955e91fe91ecfe6bec7db8db2590184d2312c.tar.bz2
pypy-26b955e91fe91ecfe6bec7db8db2590184d2312c.zip
Move test_json_extra to extra_tests/
-rw-r--r--extra_tests/test_json.py20
-rw-r--r--pypy/module/test_lib_pypy/test_json_extra.py17
2 files changed, 20 insertions, 17 deletions
diff --git a/extra_tests/test_json.py b/extra_tests/test_json.py
new file mode 100644
index 0000000000..3781881604
--- /dev/null
+++ b/extra_tests/test_json.py
@@ -0,0 +1,20 @@
+import pytest
+import json
+
+def is_(x, y):
+ return type(x) is type(y) and x == y
+
+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 ")
+
+def test_issue2191():
+ assert is_(json.dumps(u"xxx", ensure_ascii=False), u'"xxx"')
diff --git a/pypy/module/test_lib_pypy/test_json_extra.py b/pypy/module/test_lib_pypy/test_json_extra.py
deleted file mode 100644
index 6fda983ec8..0000000000
--- a/pypy/module/test_lib_pypy/test_json_extra.py
+++ /dev/null
@@ -1,17 +0,0 @@
-import py, json
-
-def is_(x, y):
- return type(x) is type(y) and x == y
-
-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"')
- e = py.test.raises(UnicodeDecodeError, json.dumps,
- (u"\u1234", "\xc0"), ensure_ascii=False)
- assert str(e.value).startswith("'ascii' codec can't decode byte 0xc0 ")
- e = py.test.raises(UnicodeDecodeError, json.dumps,
- ("\xc0", u"\u1234"), ensure_ascii=False)
- assert str(e.value).startswith("'ascii' codec can't decode byte 0xc0 ")
-
-def test_issue2191():
- assert is_(json.dumps(u"xxx", ensure_ascii=False), u'"xxx"')