MCPcopy Index your code
hub / github.com/python/cpython / test_invalid_tzstr

Method test_invalid_tzstr

Lib/test/test_zoneinfo/test_zoneinfo.py:1142–1223  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1140 self.zone_from_tzstr(tzstr)
1141
1142 def test_invalid_tzstr(self):
1143 invalid_tzstrs = [
1144 "PST8PDT", # DST but no transition specified
1145 "+11", # Unquoted alphanumeric
1146 "GMT,M3.2.0/2,M11.1.0/3", # Transition rule but no DST
1147 "GMT0+11,M3.2.0/2,M11.1.0/3", # Unquoted alphanumeric in DST
1148 "PST8PDT,M3.2.0/2", # Only one transition rule
1149 # Invalid offset hours
1150 "AAA168",
1151 "AAA+168",
1152 "AAA-168",
1153 "AAA168BBB,J60/2,J300/2",
1154 "AAA+168BBB,J60/2,J300/2",
1155 "AAA-168BBB,J60/2,J300/2",
1156 "AAA4BBB168,J60/2,J300/2",
1157 "AAA4BBB+168,J60/2,J300/2",
1158 "AAA4BBB-168,J60/2,J300/2",
1159 # Invalid offset minutes
1160 "AAA4:0BBB,J60/2,J300/2",
1161 "AAA4:100BBB,J60/2,J300/2",
1162 "AAA4BBB5:0,J60/2,J300/2",
1163 "AAA4BBB5:100,J60/2,J300/2",
1164 # Invalid offset seconds
1165 "AAA4:00:0BBB,J60/2,J300/2",
1166 "AAA4:00:100BBB,J60/2,J300/2",
1167 "AAA4BBB5:00:0,J60/2,J300/2",
1168 "AAA4BBB5:00:100,J60/2,J300/2",
1169 # Completely invalid dates
1170 "AAA4BBB,M1443339,M11.1.0/3",
1171 "AAA4BBB,M3.2.0/2,0349309483959c",
1172 "AAA4BBB,,J300/2",
1173 "AAA4BBB,z,J300/2",
1174 "AAA4BBB,J60/2,",
1175 "AAA4BBB,J60/2,z",
1176 # Invalid months
1177 "AAA4BBB,M13.1.1/2,M1.1.1/2",
1178 "AAA4BBB,M1.1.1/2,M13.1.1/2",
1179 "AAA4BBB,M0.1.1/2,M1.1.1/2",
1180 "AAA4BBB,M1.1.1/2,M0.1.1/2",
1181 # Invalid weeks
1182 "AAA4BBB,M1.6.1/2,M1.1.1/2",
1183 "AAA4BBB,M1.1.1/2,M1.6.1/2",
1184 # Invalid weekday
1185 "AAA4BBB,M1.1.7/2,M2.1.1/2",
1186 "AAA4BBB,M1.1.1/2,M2.1.7/2",
1187 # Invalid numeric offset
1188 "AAA4BBB,-1/2,20/2",
1189 "AAA4BBB,1/2,-1/2",
1190 "AAA4BBB,367,20/2",
1191 "AAA4BBB,1/2,367/2",
1192 # Invalid julian offset
1193 "AAA4BBB,J0/2,J20/2",
1194 "AAA4BBB,J20/2,J366/2",
1195 # Invalid transition time
1196 "AAA4BBB,J60/2/3,J300/2",
1197 "AAA4BBB,J60/2,J300/2/3",
1198 # Invalid transition hour
1199 "AAA4BBB,J60/168,J300/2",

Callers

nothing calls this directly

Calls 4

zone_from_tzstrMethod · 0.95
escapeMethod · 0.80
assertRaisesRegexMethod · 0.80
subTestMethod · 0.45

Tested by

no test coverage detected