def assertHandlersPassedObjectWithAsString( self, handlers, expected_as_string): for _, handler in handlers.items(): self.assertEqual(1, handler.publish_event.call_count) event = handler.publish_event.call_args[0][0] self.assertEqual(expected_as_string, event.as_string())