MCPcopy Index your code
hub / github.com/python-pendulum/pendulum / test_parse_iso8601_invalid

Function test_parse_iso8601_invalid

tests/parsing/test_parse_iso8601.py:93–168  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

91
92
93def test_parse_iso8601_invalid():
94 # Invalid month
95 with pytest.raises(ValueError):
96 parse_iso8601("20161306T123456")
97
98 # Invalid day
99 with pytest.raises(ValueError):
100 parse_iso8601("20161033T123456")
101
102 # Invalid day for month
103 with pytest.raises(ValueError):
104 parse_iso8601("20161131T123456")
105
106 # Invalid hour
107 with pytest.raises(ValueError):
108 parse_iso8601("20161006T243456")
109
110 # Invalid minute
111 with pytest.raises(ValueError):
112 parse_iso8601("20161006T126056")
113
114 # Invalid second
115 with pytest.raises(ValueError):
116 parse_iso8601("20161006T123460")
117
118 # Extraneous separator
119 with pytest.raises(ValueError):
120 parse_iso8601("20140203 04:05:.123456")
121 with pytest.raises(ValueError):
122 parse_iso8601("2009-05-19 14:")
123
124 # Invalid ordinal
125 with pytest.raises(ValueError):
126 parse_iso8601("2009367")
127 with pytest.raises(ValueError):
128 parse_iso8601("2009-367")
129 with pytest.raises(ValueError):
130 parse_iso8601("2015-366")
131 with pytest.raises(ValueError):
132 parse_iso8601("2015-000")
133
134 # Invalid date
135 with pytest.raises(ValueError):
136 parse_iso8601("2009-")
137
138 # Invalid time
139 with pytest.raises(ValueError):
140 parse_iso8601("2009-05-19T14:3924")
141 with pytest.raises(ValueError):
142 parse_iso8601("2010-02-18T16.5:23.35:48")
143 with pytest.raises(ValueError):
144 parse_iso8601("2010-02-18T16:23.35:48.45")
145 with pytest.raises(ValueError):
146 parse_iso8601("2010-02-18T16:23.33.600")
147
148 # Invalid offset
149 with pytest.raises(ValueError):
150 parse_iso8601("2009-05-19 14:39:22+063")

Callers

nothing calls this directly

Calls 1

parse_iso8601Function · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…