Author: Carl Friedrich Bolz-Tereick <[email protected]>
Branch: py3.6
Changeset: r94706:990690db345d
Date: 2018-05-29 08:15 +0200
http://bitbucket.org/pypy/pypy/changeset/990690db345d/
Log: a test for the warning in unicode_escape_decode
diff --git a/pypy/module/_codecs/test/test_codecs.py
b/pypy/module/_codecs/test/test_codecs.py
--- a/pypy/module/_codecs/test/test_codecs.py
+++ b/pypy/module/_codecs/test/test_codecs.py
@@ -2,7 +2,7 @@
class AppTestCodecs:
spaceconfig = {
- "usemodules": ['unicodedata', 'struct', 'binascii'],
+ "usemodules": ['unicodedata', 'struct', 'binascii', '_warnings'],
}
def test_register_noncallable(self):
@@ -999,3 +999,16 @@
errors = []
assert sin.encode("iso-8859-15", "test.record") == b"\xac\xa4"
assert errors == [u'\u1234\u1234', u'\u8000']
+
+ def test_warn_escape_decode(self):
+ import warnings
+ import codecs
+
+ with warnings.catch_warnings(record=True) as l:
+ warnings.simplefilter("always")
+ codecs.unicode_escape_decode(b'\\A')
+
+ assert isinstance(l[0].message, DeprecationWarning)
+
+
+
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit