if encoded_expected_value is None or encoded_value != encoded_expected_value:
is using != rather than relying on the internal compare function, which means that this code cannot be adapted easily to types that do not support regular Python comparison, especially numpy arrays.
(Aside, it'd be especially nice if the Snapshot class allowed compare/encode/decode to be customized more easily; I'm currently experimenting with array comparison using numpy.allclose() by patching the internal _get_compare_encode_decode function.)
This line:
is using
!=
rather than relying on the internalcompare
function, which means that this code cannot be adapted easily to types that do not support regular Python comparison, especiallynumpy
arrays.(Aside, it'd be especially nice if the
Snapshot
class allowed compare/encode/decode to be customized more easily; I'm currently experimenting with array comparison usingnumpy.allclose()
by patching the internal_get_compare_encode_decode
function.)