In the following code, is there a way to assert that the query attribute has been set if search is a mock object? Or if query was the mock object, is there a way to do it?
search.query = Q('bool', must=must)
So far I've found out that Python unittest.mock only supports asserting that mocks have been called as functions. Also the setattr magic method can not be mocked so search.__setattr__ can not be used to assert the above.
Aucun commentaire:
Enregistrer un commentaire