MCPcopy Create free account
hub / github.com/mongodb/mongo-python-driver / test_keys

Method test_keys

test/test_son.py:172–188  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

170 self.assertEqual(2, len(test_son))
171
172 def test_keys(self):
173 # Test to make sure that set operations do not throw an error
174 d = SON().keys()
175 for i in [OrderedDict, dict]:
176 try:
177 d - i().keys()
178 except TypeError:
179 self.fail(
180 "SON().keys() is not returning an object compatible "
181 "with %s objects" % (str(i))
182 )
183 # Test to verify correctness
184 d = SON({"k": "v"}).keys()
185 for i in [OrderedDict, dict]:
186 self.assertEqual(d | i({"k1": 0}).keys(), {"k", "k1"})
187 for i in [OrderedDict, dict]:
188 self.assertEqual(d - i({"k": 0}).keys(), set())
189
190
191if __name__ == "__main__":

Callers

nothing calls this directly

Calls 2

SONClass · 0.90
keysMethod · 0.80

Tested by

no test coverage detected