Python mimetypes._winreg() Examples
The following are 12
code examples of mimetypes._winreg().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
mimetypes
, or try the search function
.
Example #1
Source File: test_mimetypes.py From ironpython2 with Apache License 2.0 | 6 votes |
def test_non_latin_extension(self): import _winreg class MockWinreg(object): def __getattr__(self, name): if name == 'EnumKey': return lambda key, i: _winreg.EnumKey(key, i) + "\xa3" elif name == 'OpenKey': return lambda key, name: _winreg.OpenKey(key, name.rstrip("\xa3")) elif name == 'QueryValueEx': return lambda subkey, label: (u'текст/простой' , _winreg.REG_SZ) return getattr(_winreg, name) mimetypes._winreg = MockWinreg() try: # this used to throw an exception if registry contained non-Latin # characters in extensions (issue #9291) mimetypes.init() finally: mimetypes._winreg = _winreg
Example #2
Source File: test_mimetypes.py From ironpython2 with Apache License 2.0 | 6 votes |
def test_non_latin_type(self): import _winreg class MockWinreg(object): def __getattr__(self, name): if name == 'QueryValueEx': return lambda subkey, label: (u'текст/простой', _winreg.REG_SZ) return getattr(_winreg, name) mimetypes._winreg = MockWinreg() try: # this used to throw an exception if registry contained non-Latin # characters in content types (issue #9291) mimetypes.init() finally: mimetypes._winreg = _winreg
Example #3
Source File: test_mimetypes.py From ironpython2 with Apache License 2.0 | 6 votes |
def test_registry_read_error(self): import _winreg class MockWinreg(object): def OpenKey(self, key, name): if key != _winreg.HKEY_CLASSES_ROOT: raise WindowsError(5, "Access is denied") return _winreg.OpenKey(key, name) def __getattr__(self, name): return getattr(_winreg, name) mimetypes._winreg = MockWinreg() try: mimetypes.init() finally: mimetypes._winreg = _winreg
Example #4
Source File: test_mimetypes.py From oss-ftp with MIT License | 6 votes |
def test_non_latin_extension(self): import _winreg class MockWinreg(object): def __getattr__(self, name): if name == 'EnumKey': return lambda key, i: _winreg.EnumKey(key, i) + "\xa3" elif name == 'OpenKey': return lambda key, name: _winreg.OpenKey(key, name.rstrip("\xa3")) elif name == 'QueryValueEx': return lambda subkey, label: (u'текст/простой' , _winreg.REG_SZ) return getattr(_winreg, name) mimetypes._winreg = MockWinreg() try: # this used to throw an exception if registry contained non-Latin # characters in extensions (issue #9291) mimetypes.init() finally: mimetypes._winreg = _winreg
Example #5
Source File: test_mimetypes.py From oss-ftp with MIT License | 6 votes |
def test_non_latin_type(self): import _winreg class MockWinreg(object): def __getattr__(self, name): if name == 'QueryValueEx': return lambda subkey, label: (u'текст/простой', _winreg.REG_SZ) return getattr(_winreg, name) mimetypes._winreg = MockWinreg() try: # this used to throw an exception if registry contained non-Latin # characters in content types (issue #9291) mimetypes.init() finally: mimetypes._winreg = _winreg
Example #6
Source File: test_mimetypes.py From oss-ftp with MIT License | 6 votes |
def test_registry_read_error(self): import _winreg class MockWinreg(object): def OpenKey(self, key, name): if key != _winreg.HKEY_CLASSES_ROOT: raise WindowsError(5, "Access is denied") return _winreg.OpenKey(key, name) def __getattr__(self, name): return getattr(_winreg, name) mimetypes._winreg = MockWinreg() try: mimetypes.init() finally: mimetypes._winreg = _winreg
Example #7
Source File: test_mimetypes.py From gcblue with BSD 3-Clause "New" or "Revised" License | 6 votes |
def test_non_latin_extension(self): import _winreg class MockWinreg(object): def __getattr__(self, name): if name == 'EnumKey': return lambda key, i: _winreg.EnumKey(key, i) + "\xa3" elif name == 'OpenKey': return lambda key, name: _winreg.OpenKey(key, name.rstrip("\xa3")) elif name == 'QueryValueEx': return lambda subkey, label: (u'текст/простой' , _winreg.REG_SZ) return getattr(_winreg, name) mimetypes._winreg = MockWinreg() try: # this used to throw an exception if registry contained non-Latin # characters in extensions (issue #9291) mimetypes.init() finally: mimetypes._winreg = _winreg
Example #8
Source File: test_mimetypes.py From gcblue with BSD 3-Clause "New" or "Revised" License | 6 votes |
def test_non_latin_type(self): import _winreg class MockWinreg(object): def __getattr__(self, name): if name == 'QueryValueEx': return lambda subkey, label: (u'текст/простой', _winreg.REG_SZ) return getattr(_winreg, name) mimetypes._winreg = MockWinreg() try: # this used to throw an exception if registry contained non-Latin # characters in content types (issue #9291) mimetypes.init() finally: mimetypes._winreg = _winreg
Example #9
Source File: test_mimetypes.py From gcblue with BSD 3-Clause "New" or "Revised" License | 6 votes |
def test_registry_read_error(self): import _winreg class MockWinreg(object): def OpenKey(self, key, name): if key != _winreg.HKEY_CLASSES_ROOT: raise WindowsError(5, "Access is denied") return _winreg.OpenKey(key, name) def __getattr__(self, name): return getattr(_winreg, name) mimetypes._winreg = MockWinreg() try: mimetypes.init() finally: mimetypes._winreg = _winreg
Example #10
Source File: test_mimetypes.py From ironpython2 with Apache License 2.0 | 5 votes |
def test_type_map_values(self): import _winreg class MockWinreg(object): def __getattr__(self, name): if name == 'QueryValueEx': return lambda subkey, label: (u'text/plain', _winreg.REG_SZ) return getattr(_winreg, name) mimetypes._winreg = MockWinreg() try: mimetypes.init() self.assertTrue(isinstance(mimetypes.types_map.values()[0], str)) finally: mimetypes._winreg = _winreg
Example #11
Source File: test_mimetypes.py From oss-ftp with MIT License | 5 votes |
def test_type_map_values(self): import _winreg class MockWinreg(object): def __getattr__(self, name): if name == 'QueryValueEx': return lambda subkey, label: (u'text/plain', _winreg.REG_SZ) return getattr(_winreg, name) mimetypes._winreg = MockWinreg() try: mimetypes.init() self.assertTrue(isinstance(mimetypes.types_map.values()[0], str)) finally: mimetypes._winreg = _winreg
Example #12
Source File: test_mimetypes.py From gcblue with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_type_map_values(self): import _winreg class MockWinreg(object): def __getattr__(self, name): if name == 'QueryValueEx': return lambda subkey, label: (u'text/plain', _winreg.REG_SZ) return getattr(_winreg, name) mimetypes._winreg = MockWinreg() try: mimetypes.init() self.assertTrue(isinstance(mimetypes.types_map.values()[0], str)) finally: mimetypes._winreg = _winreg