@@ -340,7 +340,9 @@ def _operation_type(self, spec, actual, key_to_compare):
340
340
actual [key_to_compare ], permissible_types )
341
341
342
342
def _operation_matchesEntity (self , spec , actual , key_to_compare ):
343
- raise NotImplementedError
343
+ expected_entity = self ._test_class .entity_map [spec ]
344
+ self ._test_class .assertIsInstance (expected_entity , abc .Mapping )
345
+ self ._test_class .assertEqual (expected_entity , actual [key_to_compare ])
344
346
345
347
def _operation_matchesHexBytes (self , spec , actual , key_to_compare ):
346
348
raise NotImplementedError
@@ -564,13 +566,19 @@ def process_error(self, exception, spec):
564
566
self .assertNotIsInstance (exception , PyMongoError )
565
567
566
568
if error_contains :
567
- raise NotImplementedError
569
+ if isinstance (exception , BulkWriteError ):
570
+ errmsg = str (exception .details ).lower ()
571
+ else :
572
+ errmsg = str (exception ).lower ()
573
+ self .assertIn (error_contains .lower (), errmsg )
568
574
569
575
if error_code :
570
- raise NotImplementedError
576
+ self .assertEqual (
577
+ error_code , exception .details .get ('code' ))
571
578
572
579
if error_code_name :
573
- raise NotImplementedError
580
+ self .assertEqual (
581
+ error_code_name , exception .details .get ('codeName' ))
574
582
575
583
if error_labels_contain :
576
584
labels = [err_label for err_label in error_labels_contain
0 commit comments