From: Serhiy Storchaka Date: Mon, 29 Jul 2024 10:40:16 +0000 (+0300) Subject: gh-122311: Add more tests for error messages in pickle (GH-122373) X-Git-Tag: v3.14.0a1~950 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0697188084bf61b28f258fbbe867e1010d679b3e;p=thirdparty%2FPython%2Fcpython.git gh-122311: Add more tests for error messages in pickle (GH-122373) --- diff --git a/Lib/test/pickletester.py b/Lib/test/pickletester.py index a2b49e6c92a7..3c936b3bc402 100644 --- a/Lib/test/pickletester.py +++ b/Lib/test/pickletester.py @@ -1229,24 +1229,38 @@ class AbstractUnpickleTests: self.assertIs(unpickler.find_class('os.path', 'join'), os.path.join) self.assertIs(unpickler4.find_class('builtins', 'str.upper'), str.upper) - with self.assertRaises(AttributeError): + with self.assertRaisesRegex(AttributeError, + r"module 'builtins' has no attribute 'str\.upper'|" + r"Can't get attribute 'str\.upper' on \.spam'|" + r"Can't get attribute 'log\.\.spam' on .spam') - with self.assertRaises(AttributeError): + with self.assertRaisesRegex(AttributeError, + r"Can't get local attribute 'log\.\.spam' on .spam') - with self.assertRaises(AttributeError): + with self.assertRaisesRegex(AttributeError, + "module 'math' has no attribute ''|" + "Can't get attribute '' on )' + r' must return (a )?string or tuple') with self.assertRaisesRegex( ValueError, 'The reducer just failed'):