MCPcopy Index your code
hub / github.com/mongodb/mongo-python-driver / test_datetime_copy_pickle

Method test_datetime_copy_pickle

test/test_timestamp.py:44–54  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

42 self.assertEqual(d, t.as_datetime())
43
44 def test_datetime_copy_pickle(self):
45 d = datetime.datetime(2010, 5, 5, tzinfo=utc)
46 t = Timestamp(d, 0)
47
48 dc = copy.deepcopy(d)
49 self.assertEqual(dc, t.as_datetime())
50
51 for protocol in [0, 1, 2, -1]:
52 pkl = pickle.dumps(d, protocol=protocol)
53 dp = pickle.loads(pkl)
54 self.assertEqual(dp, t.as_datetime())
55
56 def test_exceptions(self):
57 self.assertRaises(TypeError, Timestamp)

Callers

nothing calls this directly

Calls 2

as_datetimeMethod · 0.95
TimestampClass · 0.90

Tested by

no test coverage detected