Dictionaries shared among unit tests

I was recently writing some unit tests for some data serializer methods for a third party market data API in Django and one of my tests used a dictionary to mock a JSON response from an API. I wanted to be DRY so I reused the same dictionary and using a few class properties, I modified the values to represent different scenarios where the data might be invalid (this API is not very stable). But I mistakenly reused that dictionary across a few tests without deepcopy causing test failures
Nabil Jamaleddine | 2016-12-20 #django #tests #dictionaries #python