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

Method test_repr_str

test/test_objectid.py:60–71  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

58 self.assertRaises(InvalidId, ObjectId, "123456789012123456789G12")
59
60 def test_repr_str(self):
61 self.assertEqual(
62 repr(ObjectId("1234567890abcdef12345678")), "ObjectId('1234567890abcdef12345678')"
63 )
64 self.assertEqual(str(ObjectId("1234567890abcdef12345678")), "1234567890abcdef12345678")
65 self.assertEqual(str(ObjectId(b"123456789012")), "313233343536373839303132")
66 self.assertEqual(
67 ObjectId("1234567890abcdef12345678").binary, b"\x124Vx\x90\xab\xcd\xef\x124Vx"
68 )
69 self.assertEqual(
70 str(ObjectId(b"\x124Vx\x90\xab\xcd\xef\x124Vx")), "1234567890abcdef12345678"
71 )
72
73 def test_equality(self):
74 a = ObjectId()

Callers

nothing calls this directly

Calls 1

ObjectIdClass · 0.90

Tested by

no test coverage detected