Antoine Pitrou added the comment: Since I was asked on IRC, an example of converting an existing test. It's quite trivial really:
diff --git a/Lib/test/test_codecs.py b/Lib/test/test_codecs.py --- a/Lib/test/test_codecs.py +++ b/Lib/test/test_codecs.py @@ -630,9 +630,10 @@ class UTF16BETest(ReadTest, unittest.Tes (b'\xdc\x00\x00A', '\ufffdA'), ] for raw, expected in tests: - self.assertRaises(UnicodeDecodeError, codecs.utf_16_be_decode, - raw, 'strict', True) - self.assertEqual(raw.decode('utf-16be', 'replace'), expected) + with self.subTest(raw=raw, expected=expected): + self.assertRaises(UnicodeDecodeError, codecs.utf_16_be_decode, + raw, 'strict', True) + self.assertEqual(raw.decode('utf-16be', 'replace'), expected) def test_nonbmp(self): self.assertEqual("\U00010203".encode(self.encoding), ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue16997> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com