Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/pytz-2023.3-py3.8.egg/pytz/exceptions.py: 100%
7 statements
« prev ^ index » next coverage.py v7.2.7, created at 2023-06-07 07:00 +0000
« prev ^ index » next coverage.py v7.2.7, created at 2023-06-07 07:00 +0000
1'''
2Custom exceptions raised by pytz.
3'''
5__all__ = [
6 'UnknownTimeZoneError', 'InvalidTimeError', 'AmbiguousTimeError',
7 'NonExistentTimeError',
8]
11class Error(Exception):
12 '''Base class for all exceptions raised by the pytz library'''
15class UnknownTimeZoneError(KeyError, Error):
16 '''Exception raised when pytz is passed an unknown timezone.
18 >>> isinstance(UnknownTimeZoneError(), LookupError)
19 True
21 This class is actually a subclass of KeyError to provide backwards
22 compatibility with code relying on the undocumented behavior of earlier
23 pytz releases.
25 >>> isinstance(UnknownTimeZoneError(), KeyError)
26 True
28 And also a subclass of pytz.exceptions.Error, as are other pytz
29 exceptions.
31 >>> isinstance(UnknownTimeZoneError(), Error)
32 True
34 '''
35 pass
38class InvalidTimeError(Error):
39 '''Base class for invalid time exceptions.'''
42class AmbiguousTimeError(InvalidTimeError):
43 '''Exception raised when attempting to create an ambiguous wallclock time.
45 At the end of a DST transition period, a particular wallclock time will
46 occur twice (once before the clocks are set back, once after). Both
47 possibilities may be correct, unless further information is supplied.
49 See DstTzInfo.normalize() for more info
50 '''
53class NonExistentTimeError(InvalidTimeError):
54 '''Exception raised when attempting to create a wallclock time that
55 cannot exist.
57 At the start of a DST transition period, the wallclock time jumps forward.
58 The instants jumped over never occur.
59 '''