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

Method test_str

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

Source from the content-addressed store, hash-verified

156 return ZoneDumpData.load_transition_examples(key)
157
158 def test_str(self):
159 # Zones constructed with a key must have str(zone) == key
160 for key in self.zones():
161 with self.subTest(key):
162 zi = self.zone_from_key(key)
163
164 self.assertEqual(str(zi), key)
165
166 # Zones with no key constructed should have str(zone) == repr(zone)
167 file_key = self.zoneinfo_data.keys[0]
168 file_path = self.zoneinfo_data.path_from_key(file_key)
169
170 with open(file_path, "rb") as f:
171 with self.subTest(test_name="Repr test", path=file_path):
172 zi_ff = self.klass.from_file(f)
173 self.assertEqual(str(zi_ff), repr(zi_ff))
174
175 def test_repr(self):
176 # The repr is not guaranteed, but I think we can insist that it at

Callers

nothing calls this directly

Calls 8

zonesMethod · 0.95
zone_from_keyMethod · 0.95
strFunction · 0.85
path_from_keyMethod · 0.80
openFunction · 0.50
subTestMethod · 0.45
assertEqualMethod · 0.45
from_fileMethod · 0.45

Tested by

no test coverage detected