|
| 1 | +import re |
1 | 2 | import unittest as ut |
2 | 3 | import winreg |
3 | 4 |
|
|
12 | 13 | HKCR = 0 # HKEY_CLASSES_ROOT |
13 | 14 | HKCU = 1 # HKEY_CURRENT_USER |
14 | 15 |
|
| 16 | +NAMED_PARAM_ERRMSG = "named parameters not yet implemented" |
| 17 | + |
15 | 18 |
|
16 | 19 | class Test_Installer(ut.TestCase): |
17 | 20 | def test_registry_value_with_root_key_value(self): |
@@ -58,20 +61,20 @@ def test_registry_value_with_named_params(self): |
58 | 61 | # if named arguments are passed to prevent invalid calls. |
59 | 62 | # TODO: After named parameters are supported, this will become a test to |
60 | 63 | # assert the return value. |
61 | | - ERRMSG = "named parameters not yet implemented" |
62 | | - with self.assertRaises(ValueError, msg=ERRMSG): |
| 64 | + PTN = re.compile(rf"^{re.escape(NAMED_PARAM_ERRMSG)}$") |
| 65 | + with self.assertRaisesRegex(ValueError, PTN): |
63 | 66 | inst.RegistryValue(Root=HKCR, Key=".txt", Value="") # type: ignore |
64 | | - with self.assertRaises(ValueError, msg=ERRMSG): |
| 67 | + with self.assertRaisesRegex(ValueError, PTN): |
65 | 68 | inst.RegistryValue(Value="", Root=HKCR, Key=".txt") # type: ignore |
66 | | - with self.assertRaises(ValueError, msg=ERRMSG): |
| 69 | + with self.assertRaisesRegex(ValueError, PTN): |
67 | 70 | inst.RegistryValue(HKCR, Key=".txt", Value="") # type: ignore |
68 | | - with self.assertRaises(ValueError, msg=ERRMSG): |
| 71 | + with self.assertRaisesRegex(ValueError, PTN): |
69 | 72 | inst.RegistryValue(HKCR, ".txt", Value="") # type: ignore |
70 | | - with self.assertRaises(ValueError, msg=ERRMSG): |
| 73 | + with self.assertRaisesRegex(ValueError, PTN): |
71 | 74 | inst.RegistryValue(Root=HKCU, Key=r"Control Panel\Desktop") # type: ignore |
72 | | - with self.assertRaises(ValueError, msg=ERRMSG): |
| 75 | + with self.assertRaisesRegex(ValueError, PTN): |
73 | 76 | inst.RegistryValue(Key=r"Control Panel\Desktop", Root=HKCR) # type: ignore |
74 | | - with self.assertRaises(ValueError, msg=ERRMSG): |
| 77 | + with self.assertRaisesRegex(ValueError, PTN): |
75 | 78 | inst.RegistryValue(HKCR, Key=r"Control Panel\Desktop") # type: ignore |
76 | 79 |
|
77 | 80 | def test_product_state(self): |
|
0 commit comments