MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_compat_unpickle

Method test_compat_unpickle

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

Source from the content-addressed store, hash-verified

3992 self.assertTrue(isinstance(derived, SubclassTime))
3993
3994 def test_compat_unpickle(self):
3995 tests = [
3996 (b"cdatetime\ntime\n(S'\\x14;\\x10\\x00\\x10\\x00'\ntR.",
3997 (20, 59, 16, 64**2)),
3998 (b'cdatetime\ntime\n(U\x06\x14;\x10\x00\x10\x00tR.',
3999 (20, 59, 16, 64**2)),
4000 (b'\x80\x02cdatetime\ntime\nU\x06\x14;\x10\x00\x10\x00\x85R.',
4001 (20, 59, 16, 64**2)),
4002 (b"cdatetime\ntime\n(S'\\x14;\\x19\\x00\\x10\\x00'\ntR.",
4003 (20, 59, 25, 64**2)),
4004 (b'cdatetime\ntime\n(U\x06\x14;\x19\x00\x10\x00tR.',
4005 (20, 59, 25, 64**2)),
4006 (b'\x80\x02cdatetime\ntime\nU\x06\x14;\x19\x00\x10\x00\x85R.',
4007 (20, 59, 25, 64**2)),
4008 ]
4009 for i, (data, args) in enumerate(tests):
4010 with self.subTest(i=i):
4011 expected = self.theclass(*args)
4012 for loads in pickle_loads:
4013 derived = loads(data, encoding='latin1')
4014 self.assertEqual(derived, expected)
4015
4016 def test_strptime(self):
4017 # bpo-34482: Check that surrogates are handled properly.

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected