Construct a date from a string in ISO 8601 format.
(cls, date_string)
| 978 | |
| 979 | @classmethod |
| 980 | def fromisoformat(cls, date_string): |
| 981 | """Construct a date from a string in ISO 8601 format.""" |
| 982 | if not isinstance(date_string, str): |
| 983 | raise TypeError('fromisoformat: argument must be str') |
| 984 | |
| 985 | if len(date_string) not in (7, 8, 10): |
| 986 | raise ValueError(f'Invalid isoformat string: {date_string!r}') |
| 987 | |
| 988 | try: |
| 989 | return cls(*_parse_isoformat_date(date_string)) |
| 990 | except Exception: |
| 991 | raise ValueError(f'Invalid isoformat string: {date_string!r}') |
| 992 | |
| 993 | @classmethod |
| 994 | def fromisocalendar(cls, year, week, day): |
no test coverage detected