示例#1
0
 def test_del_value(self):
     key = RegistryKey(self.SET_TEST_KEY_PATH)
     key['test'] = Dword(42)
     key.flush()
     del key['test']
     key.flush()
     assert 'test' not in key.values()
示例#2
0
    def test_default_value(self):
        key = RegistryKey(self.SET_TEST_KEY_PATH)

        key.default_value = Dword(42)
        assert key.has_default_value()
        assert key.default_value == key[''] == 42

        del key.default_value
        assert not key.has_default_value()
        assert '' not in key.values()

        key.delete()
示例#3
0
    def test_values_iter(self):
        import re

        key = RegistryKey(self.SET_TEST_KEY_PATH)

        for i in range(10):
            key[f'test{i}'] = Dword(i)
        key.flush()

        values = key.values()
        assert len(values) > 0
        for name, value in values.items():
            assert re.match(r'test([0-9])+', name) and isinstance(value, int)

        key.delete()