iris icon indicating copy to clipboard operation
iris copied to clipboard

Comparisons for FormatAgent()

Open mo-tgeddes opened this issue 1 year ago • 1 comments

✨ Feature Request

Allow objects of type FormatAgent to be compared to each other to see if they are equal. For example:

>>>import iris.fileformats
>>>from copy import deepcopy
>>>agent_copy = deepcopy(iris.fileformats.FORMAT_AGENT)
>>>agent_copy == iris.fileformats.FORMAT_AGENT
True

Currently the result would be false.

Motivation

It would be useful for testing purposes.

Additional context

Use Case ANTS uses iris.load and modifies iris.fileformats.FORMAT_AGENT to modify some FormatSpecifications and add a few more. We want it to do this within a context manager so that iris behaviour is not modified by importing ants. To test this we need to test that once outside of the context manager, the FORMAT_AGENT is the same as it was before the context manager was called. This requires comparing the FORMAT_AGENT to a copy of itself.

mo-tgeddes avatar Aug 08 '24 13:08 mo-tgeddes

@jrackham-mo tells us that the MIAO team (ANTS developers) would be interested in writing this so I have assigned @mo-tgeddes in the meantime.

trexfeathers avatar Aug 14 '24 09:08 trexfeathers