In this commit https://github.com/algolia/algoliasearch-client-python/commit/108e270dd007734c814066abd08882be48fe767c#diff-448ff623544e049c870f5282201af825, an helper function was added to the tests to remove a _metadata extra key which is added by the engine to the rules returned by the API. Instead of doing this, we could write a custom equality method for the rules that would compare a rule with another one, without comparing the _metadata field. This way, we could get read of the extra helper from our test. More importantly, this would let the user compare two rules for equality is a simpler way. This suggestion is motivated by the fact that I had to rediscover this bug and re-implement it for the Django integration in this PR https://github.com/algolia/algoliasearch-django/pull/297. Same thing goes here: should we have a proper equality function, we could use it directly in our test assertions instead of rewriting a custom _metadata removal function.
In this commit https://github.com/algolia/algoliasearch-client-python/commit/108e270dd007734c814066abd08882be48fe767c#diff-448ff623544e049c870f5282201af825, an helper function was added to the tests to remove a
_metadata
extra key which is added by the engine to the rules returned by the API. Instead of doing this, we could write a custom equality method for the rules that would compare a rule with another one, without comparing the_metadata
field. This way, we could get read of the extra helper from our test. More importantly, this would let the user compare two rules for equality is a simpler way. This suggestion is motivated by the fact that I had to rediscover this bug and re-implement it for the Django integration in this PR https://github.com/algolia/algoliasearch-django/pull/297. Same thing goes here: should we have a proper equality function, we could use it directly in our test assertions instead of rewriting a custom_metadata
removal function.WDYT?