Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
assertRaisesRegex
thanks victor!
  • Loading branch information
gpshead committed Nov 7, 2022
commit 5a3b03750f57429f7529c9e0e3603c07d38cedd9
6 changes: 2 additions & 4 deletions Lib/test/test_codecs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1553,12 +1553,10 @@ def test_builtin_encode(self):
self.assertEqual("pyth\xf6n.org.".encode("idna"), b"xn--pythn-mua.org.")

def test_builtin_decode_length_limit(self):
with self.assertRaises(UnicodeError) as ctx:
with self.assertRaisesRegex(UnicodeError, "way too long"):
(b"xn--016c"+b"a"*1100).decode("idna")
self.assertIn("way too long", str(ctx.exception))
with self.assertRaises(UnicodeError) as ctx:
with self.assertRaisesRegex(UnicodeError, "too long"):
(b"xn--016c"+b"a"*70).decode("idna")
self.assertIn("too long", str(ctx.exception))

def test_stream(self):
r = codecs.getreader("idna")(io.BytesIO(b"abc"))
Expand Down