Skip to content

Commit 4510600

Browse files
committed
add more operators
1 parent 1ab61ca commit 4510600

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

test/unified_format.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,9 @@ def _operation_type(self, spec, actual, key_to_compare):
340340
actual[key_to_compare], permissible_types)
341341

342342
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])
344346

345347
def _operation_matchesHexBytes(self, spec, actual, key_to_compare):
346348
raise NotImplementedError
@@ -564,13 +566,19 @@ def process_error(self, exception, spec):
564566
self.assertNotIsInstance(exception, PyMongoError)
565567

566568
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)
568574

569575
if error_code:
570-
raise NotImplementedError
576+
self.assertEqual(
577+
error_code, exception.details.get('code'))
571578

572579
if error_code_name:
573-
raise NotImplementedError
580+
self.assertEqual(
581+
error_code_name, exception.details.get('codeName'))
574582

575583
if error_labels_contain:
576584
labels = [err_label for err_label in error_labels_contain

0 commit comments

Comments
 (0)