From: Brian Curtin Date: Sat, 3 Apr 2010 00:59:32 +0000 (+0000) Subject: Fix assertRaises usage on reflection functions which should raise X-Git-Tag: v2.7b1~119 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e9da81c62bd489e7c0347e896bf6d108f8a10f97;p=thirdparty%2FPython%2Fcpython.git Fix assertRaises usage on reflection functions which should raise NotImplementedError on Windows XP and below. --- diff --git a/Lib/test/test_winreg.py b/Lib/test/test_winreg.py index c1a3d188b97c..753be746040c 100644 --- a/Lib/test/test_winreg.py +++ b/Lib/test/test_winreg.py @@ -242,11 +242,14 @@ class LocalWinregTests(BaseWinregTests): key = OpenKey(HKEY_CURRENT_USER, test_key_name) self.assertNotEqual(key.handle, 0) - self.assertRaises(NotImplementedError, DisableReflectionKey(key)) - self.assertRaises(NotImplementedError, EnableReflectionKey(key)) - self.assertRaises(NotImplementedError, QueryReflectionKey(key)) - self.assertRaises(NotImplementedError, - DeleteKeyEx(HKEY_CURRENT_USER, test_key_name)) + with self.assertRaises(NotImplementedError): + DisableReflectionKey(key) + with self.assertRaises(NotImplementedError): + EnableReflectionKey(key) + with self.assertRaises(NotImplementedError): + QueryReflectionKey(key) + with self.assertRaises(NotImplementedError): + DeleteKeyEx(HKEY_CURRENT_USER, test_key_name) finally: DeleteKey(HKEY_CURRENT_USER, test_key_name)