diff options
author | Brian Curtin <brian.curtin@gmail.com> | 2010-09-27 17:56:36 +0000 |
---|---|---|
committer | Brian Curtin <brian.curtin@gmail.com> | 2010-09-27 17:56:36 +0000 |
commit | 1771b54bed1faa2d8216d3d9d76d3f604e93336d (patch) | |
tree | 361315621eb0736d5a6ab3a34b21e86d3945e619 /Lib/test/test_winreg.py | |
parent | 6d7df638370b7298a78af1e55e6cbb36f77b42ec (diff) | |
download | cpython-git-1771b54bed1faa2d8216d3d9d76d3f604e93336d.tar.gz |
Implement #8521. Added named argument handling to winreg's CreateKeyEx,
DeleteKeyEx, and OpenKeyEx.
Note that CKE and DKE are new functions for 3.2 so I didn't give them a
versionchanged because of the existing versionadded. OpenKeyEx already
existed so it gets a versionchanged tag.
Diffstat (limited to 'Lib/test/test_winreg.py')
-rw-r--r-- | Lib/test/test_winreg.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/Lib/test/test_winreg.py b/Lib/test/test_winreg.py index c5ee846460..47570389d9 100644 --- a/Lib/test/test_winreg.py +++ b/Lib/test/test_winreg.py @@ -185,6 +185,16 @@ class BaseWinregTests(unittest.TestCase): self._read_test_data(root_key, subkeystr) self._delete_test_data(root_key, subkeystr) + def _test_named_args(self, key, sub_key): + with CreateKeyEx(key=key, sub_key=sub_key, reserved=0, + access=KEY_ALL_ACCESS) as ckey: + self.assertTrue(ckey.handle != 0) + + with OpenKeyEx(key=key, sub_key=sub_key, reserved=0, + access=KEY_ALL_ACCESS) as okey: + self.assertTrue(okey.handle != 0) + + class LocalWinregTests(BaseWinregTests): def test_registry_works(self): @@ -203,6 +213,12 @@ class LocalWinregTests(BaseWinregTests): self._delete_test_data(HKEY_CURRENT_USER) + def test_named_arguments(self): + self._test_named_args(HKEY_CURRENT_USER, test_key_name) + # Use the regular DeleteKey to clean up + # DeleteKeyEx takes named args and is tested separately + DeleteKey(HKEY_CURRENT_USER, test_key_name) + def test_connect_registry_to_local_machine_works(self): # perform minimal ConnectRegistry test which just invokes it h = ConnectRegistry(None, HKEY_LOCAL_MACHINE) @@ -314,6 +330,12 @@ class RemoteWinregTests(BaseWinregTests): @unittest.skipUnless(WIN64_MACHINE, "x64 specific registry tests") class Win64WinregTests(BaseWinregTests): + def test_named_arguments(self): + self._test_named_args(HKEY_CURRENT_USER, test_key_name) + # Clean up and also exercise the named arguments + DeleteKeyEx(key=HKEY_CURRENT_USER, sub_key=test_key_name, + access=KEY_ALL_ACCESS, reserved=0) + def test_reflection_functions(self): # Test that we can call the query, enable, and disable functions # on a key which isn't on the reflection list with no consequences. |