FastKafka is a powerful and easy-to-use Python library for building asynchronous web services that interact with Kafka topics. Built on top of Pydantic, AIOKafka and AsyncAPI, FastKafka simplifies the process of writing producers and consumers for Kafka topics.
Why do you think creating a copy is a good idea? It is clearly overhead and not needed in most use cases. If needed, it is easy to create a copy in the body of the function.
e.g.
assertion would fail:
AssertionError: expected call not found. Expected: mock(Currency(currency='HRK')) Actual: mock(Currency(currency='EUR'))
Quick fix: add at the beginning of each consumes/produces:
msg_copy = msg.model_copy()
and use the copy in the rest of the function...Good fix: add
msg.model_copy()
to the Tester implementation