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

Method test_repr

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

Source from the content-addressed store, hash-verified

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
177 # least contain the name of the class.
178 key = next(iter(self.zones()))
179
180 zi = self.klass(key)
181 class_name = self.class_name
182 with self.subTest(name="from key"):
183 self.assertRegex(repr(zi), class_name)
184
185 file_key = self.zoneinfo_data.keys[0]
186 file_path = self.zoneinfo_data.path_from_key(file_key)
187 with open(file_path, "rb") as f:
188 zi_ff = self.klass.from_file(f, key=file_key)
189
190 with self.subTest(name="from file with key"):
191 self.assertRegex(repr(zi_ff), class_name)
192
193 with open(file_path, "rb") as f:
194 zi_ff_nk = self.klass.from_file(f)
195
196 with self.subTest(name="from file without key"):
197 self.assertRegex(repr(zi_ff_nk), class_name)
198
199 def test_key_attribute(self):
200 key = next(iter(self.zones()))

Callers

nothing calls this directly

Calls 6

zonesMethod · 0.95
assertRegexMethod · 0.80
path_from_keyMethod · 0.80
openFunction · 0.50
subTestMethod · 0.45
from_fileMethod · 0.45

Tested by

no test coverage detected