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

Method check_object

test/test_connection_monitoring.py:173–186  ·  view source on GitHub ↗

Assert that the actual object matches the expected object.

(self, actual, expected)

Source from the content-addressed store, hash-verified

171 self.run_operation(op)
172
173 def check_object(self, actual, expected):
174 """Assert that the actual object matches the expected object."""
175 self.assertEqual(type(actual), OBJECT_TYPES[expected["type"]])
176 for attr, expected_val in expected.items():
177 if attr == "type":
178 continue
179 c2s = camel_to_snake(attr)
180 if c2s == "interrupt_in_use_connections":
181 c2s = "interrupt_connections"
182 actual_val = getattr(actual, c2s)
183 if expected_val == 42:
184 self.assertIsNotNone(actual_val)
185 else:
186 self.assertEqual(actual_val, expected_val)
187
188 def check_event(self, actual, expected):
189 """Assert that the actual event matches the expected event."""

Callers 2

check_eventMethod · 0.95
check_errorMethod · 0.95

Calls 2

camel_to_snakeFunction · 0.90
itemsMethod · 0.80

Tested by

no test coverage detected