[pywin32-checkins] pywin32/win32/test test_win32api.py,1.12,1.13
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Roger U. <ru...@us...> - 2008-01-04 04:53:41
|
Update of /cvsroot/pywin32/pywin32/win32/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2364 Modified Files: test_win32api.py Log Message: Add tests for registry values Index: test_win32api.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/test/test_win32api.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** test_win32api.py 1 Jun 2007 14:57:19 -0000 1.12 --- test_win32api.py 4 Jan 2008 04:53:29 -0000 1.13 *************** *** 56,59 **** --- 56,82 ---- except ZeroDivisionError: pass + + def testValues(self): + key_name = r'PythonTestHarness\win32api' + ## tuples containing value name, value type, data + values=( + (None, win32con.REG_SZ, 'This is default unnamed value'), + ('REG_SZ', win32con.REG_SZ,'REG_SZ text data'), + ('REG_EXPAND_SZ', win32con.REG_EXPAND_SZ, '%systemdir%'), + ## REG_MULTI_SZ value needs to be a list since strings are returned as a list + ('REG_MULTI_SZ', win32con.REG_MULTI_SZ, ['string 1','string 2','string 3','string 4']), + ('REG_DWORD', win32con.REG_DWORD, 666), + ('REG_BINARY', win32con.REG_BINARY, '\x00\x01\x02\x03\x04\x05\x06\x07\x08\x01\x00'), + ) + + hkey = win32api.RegCreateKey(win32con.HKEY_CURRENT_USER, key_name) + for value_name, reg_type, data in values: + win32api.RegSetValueEx(hkey, value_name, None, reg_type, data) + + for value_name, orig_type, orig_data in values: + data, typ=win32api.RegQueryValueEx(hkey, value_name) + self.assertEqual(typ, orig_type) + self.assertEqual(data, orig_data) + def testNotifyChange(self): def change(): |