(self)
| 197 | self.assertRegex(repr(zi_ff_nk), class_name) |
| 198 | |
| 199 | def test_key_attribute(self): |
| 200 | key = next(iter(self.zones())) |
| 201 | |
| 202 | def from_file_nokey(key): |
| 203 | with open(self.zoneinfo_data.path_from_key(key), "rb") as f: |
| 204 | return self.klass.from_file(f) |
| 205 | |
| 206 | constructors = ( |
| 207 | ("Primary constructor", self.klass, key), |
| 208 | ("no_cache", self.klass.no_cache, key), |
| 209 | ("from_file", from_file_nokey, None), |
| 210 | ) |
| 211 | |
| 212 | for msg, constructor, expected in constructors: |
| 213 | zi = constructor(key) |
| 214 | |
| 215 | # Ensure that the key attribute is set to the input to ``key`` |
| 216 | with self.subTest(msg): |
| 217 | self.assertEqual(zi.key, expected) |
| 218 | |
| 219 | # Ensure that the key attribute is read-only |
| 220 | with self.subTest(f"{msg}: readonly"): |
| 221 | with self.assertRaises(AttributeError): |
| 222 | zi.key = "Some/Value" |
| 223 | |
| 224 | def test_bad_keys(self): |
| 225 | bad_keys = [ |
nothing calls this directly
no test coverage detected