Possible error in assert_equal and assert_allclose for MultiFields
In their current form, both methods assert_equal
and assert_allclose
only perform a one sided test for MultiFields
. This leads to some unexpected behaviour when comparing two Fields which are only equal one some sub-domain. In particular the following test
import nifty8 as ift
d = ift.RGSpace(10)
d = ift.MultiDomain.make({'a' : d, 'b' : d})
f = ift.from_random(d)
fp = f.extract_by_keys(['a',])
ift.extra.assert_equal(fp, f)
will pass, but
ift.extra.assert_equal(f, fp)
produces an error, as only the keys of the first input are looped over. The same goes for assert_allclose
.
This does not look like an intended behaviour to me. @mtr, @parras, am I missing something here?