summaryrefslogtreecommitdiff
path: root/Lib/test/test_winreg.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2017-01-25 13:25:52 +0200
committerSerhiy Storchaka <storchaka@gmail.com>2017-01-25 13:25:52 +0200
commit3f19a274c28567afb39ba46ea8a2ebdeab816b0b (patch)
treeb455925dd27f3d6e421d9fca9f3295b988a24254 /Lib/test/test_winreg.py
parentb0cbde5d42f12b3aca11b87c017b3c60a26be4fd (diff)
parentc8486579312320fd09c56ce9fce3da7ea0ffd132 (diff)
downloadcpython-3f19a274c28567afb39ba46ea8a2ebdeab816b0b.tar.gz
Issue #27867: Function PySlice_GetIndicesEx() is replaced with a macro if
Py_LIMITED_API is not set or set to the value between 0x03050400 and 0x03060000 (not including) or 0x03060100 or higher.
Diffstat (limited to 'Lib/test/test_winreg.py')
-rw-r--r--Lib/test/test_winreg.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/Lib/test/test_winreg.py b/Lib/test/test_winreg.py
index 60207fbb41..2be61ae15d 100644
--- a/Lib/test/test_winreg.py
+++ b/Lib/test/test_winreg.py
@@ -37,6 +37,7 @@ test_reflect_key_name = "SOFTWARE\\Classes\\" + test_key_base
test_data = [
("Int Value", 45, REG_DWORD),
+ ("Qword Value", 0x1122334455667788, REG_QWORD),
("String Val", "A string value", REG_SZ),
("StringExpand", "The path is %path%", REG_EXPAND_SZ),
("Multi-string", ["Lots", "of", "string", "values"], REG_MULTI_SZ),
@@ -56,7 +57,7 @@ class BaseWinregTests(unittest.TestCase):
def delete_tree(self, root, subkey):
try:
- hkey = OpenKey(root, subkey, KEY_ALL_ACCESS)
+ hkey = OpenKey(root, subkey, 0, KEY_ALL_ACCESS)
except OSError:
# subkey does not exist
return
@@ -367,6 +368,18 @@ class LocalWinregTests(BaseWinregTests):
finally:
DeleteKey(HKEY_CURRENT_USER, test_key_name)
+ def test_read_string_containing_null(self):
+ # Test for issue 25778: REG_SZ should not contain null characters
+ try:
+ with CreateKey(HKEY_CURRENT_USER, test_key_name) as ck:
+ self.assertNotEqual(ck.handle, 0)
+ test_val = "A string\x00 with a null"
+ SetValueEx(ck, "test_name", 0, REG_SZ, test_val)
+ ret_val, ret_type = QueryValueEx(ck, "test_name")
+ self.assertEqual(ret_type, REG_SZ)
+ self.assertEqual(ret_val, "A string")
+ finally:
+ DeleteKey(HKEY_CURRENT_USER, test_key_name)
@unittest.skipUnless(REMOTE_NAME, "Skipping remote registry tests")