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

Method test_compat_unpickle

Lib/test/datetimetester.py:4169–4189  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

4167 self.assertTrue(isinstance(derived, SubclassTime))
4168
4169 def test_compat_unpickle(self):
4170 tests = [
4171 (b"cdatetime\ntime\n(S'\\x14;\\x10\\x00\\x10\\x00'\ntR.",
4172 (20, 59, 16, 64**2)),
4173 (b'cdatetime\ntime\n(U\x06\x14;\x10\x00\x10\x00tR.',
4174 (20, 59, 16, 64**2)),
4175 (b'\x80\x02cdatetime\ntime\nU\x06\x14;\x10\x00\x10\x00\x85R.',
4176 (20, 59, 16, 64**2)),
4177 (b"cdatetime\ntime\n(S'\\x14;\\x19\\x00\\x10\\x00'\ntR.",
4178 (20, 59, 25, 64**2)),
4179 (b'cdatetime\ntime\n(U\x06\x14;\x19\x00\x10\x00tR.',
4180 (20, 59, 25, 64**2)),
4181 (b'\x80\x02cdatetime\ntime\nU\x06\x14;\x19\x00\x10\x00\x85R.',
4182 (20, 59, 25, 64**2)),
4183 ]
4184 for i, (data, args) in enumerate(tests):
4185 with self.subTest(i=i):
4186 expected = self.theclass(*args)
4187 for loads in pickle_loads:
4188 derived = loads(data, encoding='latin1')
4189 self.assertEqual(derived, expected)
4190
4191 def test_strptime(self):
4192 # bpo-34482: Check that surrogates are handled properly.

Callers

nothing calls this directly

Calls 4

enumerateFunction · 0.85
loadsFunction · 0.50
subTestMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected