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

Method test_creation

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

Source from the content-addressed store, hash-verified

36
37class TestObjectId(unittest.TestCase):
38 def test_creation(self):
39 self.assertRaises(TypeError, ObjectId, 4)
40 self.assertRaises(TypeError, ObjectId, 175.0)
41 self.assertRaises(TypeError, ObjectId, {"test": 4})
42 self.assertRaises(TypeError, ObjectId, ["something"])
43 self.assertRaises(InvalidId, ObjectId, "")
44 self.assertRaises(InvalidId, ObjectId, "12345678901")
45 self.assertRaises(InvalidId, ObjectId, "1234567890123")
46 self.assertTrue(ObjectId())
47 self.assertTrue(ObjectId(b"123456789012"))
48 a = ObjectId()
49 self.assertTrue(ObjectId(a))
50
51 def test_unicode(self):
52 a = ObjectId()

Callers

nothing calls this directly

Calls 1

ObjectIdClass · 0.90

Tested by

no test coverage detected