How to use the tzlocal.win32.get_localzone function in tzlocal

To help you get started, we’ve selected a few tzlocal examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pymedusa / Medusa / ext / tzlocal / tests.py View on Github external
def test_win32(self):
            tzlocal.win32.get_localzone()
github Tautulli / Tautulli / lib / tzlocal / tests.py View on Github external
def test_win32(self):
            tzlocal.win32.get_localzone()
github regebro / tzlocal / tests / tests.py View on Github external
def test_win32_on_unix(self, atomock):
            # Yes, winreg is all mocked out, but this test means we at least
            # catch syntax errors, etc.
            winreg = mock.MagicMock()
            winreg.OpenKey = mock.MagicMock()
            winreg.OpenKey.close = mock.MagicMock()
            winreg.QueryInfoKey = mock.MagicMock(return_value=(1, 1))
            winreg.EnumValue = mock.MagicMock(
                return_value=('TimeZoneKeyName','Belarus Standard Time'))
            winreg.EnumKey = mock.Mock(return_value='Bahia Standard Time')
            sys.modules['winreg'] = winreg
            import tzlocal.win32
            tz = tzlocal.win32.get_localzone()
            self.assertEqual(tz.zone, 'Europe/Minsk')

            tzlocal.win32.valuestodict = mock.Mock(return_value={
                'StandardName': 'Mocked Standard Time',
                'Std': 'Mocked Standard Time',
            })
            tz = tzlocal.win32.reload_localzone()
            self.assertEqual(tz.zone, 'America/Bahia')
github regebro / tzlocal / tests / tests.py View on Github external
def test_win32(self):
            tzlocal.win32.get_localzone()
github Tautulli / Tautulli / lib / tzlocal / tests.py View on Github external
def test_win32_on_unix(self):
            # Yes, winreg is all mocked out, but this test means we at least
            # catch syntax errors, etc.
            winreg = mock.MagicMock()
            winreg.OpenKey = mock.MagicMock()
            winreg.OpenKey.close = mock.MagicMock()
            winreg.QueryInfoKey = mock.MagicMock(return_value=(1, 1))
            winreg.EnumValue = mock.MagicMock(
                return_value=('TimeZoneKeyName','Belarus Standard Time'))
            winreg.EnumKey = mock.Mock(return_value='Bahia Standard Time')
            sys.modules['winreg'] = winreg
            import tzlocal.win32
            tz = tzlocal.win32.get_localzone()
            self.assertEqual(tz.zone, 'Europe/Minsk')

            tzlocal.win32.valuestodict = mock.Mock(return_value={
                'StandardName': 'Mocked Standard Time',
                'Std': 'Mocked Standard Time',
            })
            tz = tzlocal.win32.reload_localzone()
            self.assertEqual(tz.zone, 'America/Bahia')
github pymedusa / Medusa / ext / tzlocal / tests.py View on Github external
def test_win32_on_unix(self):
            # Yes, winreg is all mocked out, but this test means we at least
            # catch syntax errors, etc.
            winreg = mock.MagicMock()
            winreg.OpenKey = mock.MagicMock()
            winreg.OpenKey.close = mock.MagicMock()
            winreg.QueryInfoKey = mock.MagicMock(return_value=(1, 1))
            winreg.EnumValue = mock.MagicMock(
                return_value=('TimeZoneKeyName','Belarus Standard Time'))
            winreg.EnumKey = mock.Mock(return_value='Bahia Standard Time')
            sys.modules['winreg'] = winreg
            import tzlocal.win32
            tz = tzlocal.win32.get_localzone()
            self.assertEqual(tz.zone, 'Europe/Minsk')

            tzlocal.win32.valuestodict = mock.Mock(return_value={
                'StandardName': 'Mocked Standard Time',
                'Std': 'Mocked Standard Time',
            })
            tz = tzlocal.win32.reload_localzone()
            self.assertEqual(tz.zone, 'America/Bahia')