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

Method verify_outcome

test/unified_format.py:1436–1451  ·  view source on GitHub ↗
(self, spec)

Source from the content-addressed store, hash-verified

1434 self.match_evaluator.match_result(expected_msg, actual_msg)
1435
1436 def verify_outcome(self, spec):
1437 for collection_data in spec:
1438 coll_name = collection_data["collectionName"]
1439 db_name = collection_data["databaseName"]
1440 expected_documents = collection_data["documents"]
1441
1442 coll = self.client.get_database(db_name).get_collection(
1443 coll_name,
1444 read_preference=ReadPreference.PRIMARY,
1445 read_concern=ReadConcern(level="local"),
1446 )
1447
1448 if expected_documents is not None:
1449 sorted_expected_documents = sorted(expected_documents, key=lambda doc: doc["_id"])
1450 actual_documents = coll.find({}, sort=[("_id", ASCENDING)]).to_list()
1451 self.assertListEqual(sorted_expected_documents, actual_documents)
1452
1453 def run_scenario(self, spec, uri=None):
1454 # Handle flaky tests.

Callers 1

_run_scenarioMethod · 0.95

Calls 5

ReadConcernClass · 0.90
get_collectionMethod · 0.45
get_databaseMethod · 0.45
to_listMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected