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

Method test_creation

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

Source from the content-addressed store, hash-verified

31
32class TestDBRef(unittest.TestCase):
33 def test_creation(self):
34 a = ObjectId()
35 self.assertRaises(TypeError, DBRef)
36 self.assertRaises(TypeError, DBRef, "coll")
37 self.assertRaises(TypeError, DBRef, 4, a)
38 self.assertRaises(TypeError, DBRef, 1.5, a)
39 self.assertRaises(TypeError, DBRef, a, a)
40 self.assertRaises(TypeError, DBRef, None, a)
41 self.assertRaises(TypeError, DBRef, "coll", a, 5)
42 self.assertTrue(DBRef("coll", a))
43 self.assertTrue(DBRef("coll", 5))
44 self.assertTrue(DBRef("coll", 5, "database"))
45
46 def test_read_only(self):
47 a = DBRef("coll", ObjectId())

Callers

nothing calls this directly

Calls 2

ObjectIdClass · 0.90
DBRefClass · 0.90

Tested by

no test coverage detected