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

Method test_read_only

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

Source from the content-addressed store, hash-verified

44 self.assertTrue(DBRef("coll", 5, "database"))
45
46 def test_read_only(self):
47 a = DBRef("coll", ObjectId())
48
49 def foo():
50 a.collection = "blah" # type: ignore[misc]
51
52 def bar():
53 a.id = "aoeu" # type: ignore[misc]
54
55 self.assertEqual("coll", a.collection)
56 a.id
57 self.assertEqual(None, a.database)
58 self.assertRaises(AttributeError, foo)
59 self.assertRaises(AttributeError, bar)
60
61 def test_repr(self):
62 self.assertEqual(

Callers

nothing calls this directly

Calls 2

DBRefClass · 0.90
ObjectIdClass · 0.90

Tested by

no test coverage detected