diff options
author | Christian Heimes <christian@cheimes.de> | 2013-11-22 15:20:53 (GMT) |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2013-11-22 15:20:53 (GMT) |
commit | 5398e1a56e4483a16e4620758aad0d91e986653f (patch) | |
tree | 6aea394dbdd81213ff99db8c299b36fcf75f72e3 /Lib | |
parent | c2d65e1e9349179e10b3231820ef57ae136fdd65 (diff) | |
download | cpython-5398e1a56e4483a16e4620758aad0d91e986653f.zip cpython-5398e1a56e4483a16e4620758aad0d91e986653f.tar.gz cpython-5398e1a56e4483a16e4620758aad0d91e986653f.tar.bz2 |
Issue #19448: report name / NID in exception message of ASN1Object
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_ssl.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index 10d25e9..7374327 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -585,7 +585,8 @@ class BasicSocketTests(unittest.TestCase): self.assertEqual(val, expected) self.assertIsInstance(val, ssl._ASN1Object) self.assertRaises(ValueError, ssl._ASN1Object.fromnid, -1) - self.assertRaises(ValueError, ssl._ASN1Object.fromnid, 100000) + with self.assertRaisesRegex(ValueError, "unknown NID 100000"): + ssl._ASN1Object.fromnid(100000) for i in range(1000): try: obj = ssl._ASN1Object.fromnid(i) @@ -603,7 +604,8 @@ class BasicSocketTests(unittest.TestCase): self.assertEqual(ssl._ASN1Object.fromname('serverAuth'), expected) self.assertEqual(ssl._ASN1Object.fromname('1.3.6.1.5.5.7.3.1'), expected) - self.assertRaises(ValueError, ssl._ASN1Object.fromname, 'serverauth') + with self.assertRaisesRegex(ValueError, "unknown object 'serverauth'"): + ssl._ASN1Object.fromname('serverauth') class ContextTests(unittest.TestCase): |