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

Method test_equality

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

Source from the content-addressed store, hash-verified

74 )
75
76 def test_equality(self):
77 obj_id = ObjectId("1234567890abcdef12345678")
78
79 self.assertEqual(DBRef("foo", 5), DBRef("foo", 5))
80 self.assertEqual(DBRef("coll", obj_id), DBRef("coll", obj_id))
81 self.assertNotEqual(DBRef("coll", obj_id), DBRef("coll", obj_id, "foo"))
82 self.assertNotEqual(DBRef("coll", obj_id), DBRef("col", obj_id))
83 self.assertNotEqual(DBRef("coll", obj_id), DBRef("coll", ObjectId(b"123456789011")))
84 self.assertNotEqual(DBRef("coll", obj_id), 4)
85 self.assertNotEqual(DBRef("coll", obj_id, "foo"), DBRef("coll", obj_id, "bar"))
86
87 # Explicitly test inequality
88 self.assertFalse(DBRef("foo", 5) != DBRef("foo", 5))
89 self.assertFalse(DBRef("coll", obj_id) != DBRef("coll", obj_id))
90 self.assertFalse(DBRef("coll", obj_id, "foo") != DBRef("coll", obj_id, "foo"))
91
92 def test_kwargs(self):
93 self.assertEqual(DBRef("coll", 5, foo="bar"), DBRef("coll", 5, foo="bar"))

Callers

nothing calls this directly

Calls 2

ObjectIdClass · 0.90
DBRefClass · 0.90

Tested by

no test coverage detected