diff --git a/gwinc/__init__.py b/gwinc/__init__.py index d97f79c37907648657ccce8b53c575976a2b9ad9..3ffc22b752422f904e2297d9f7781b2c4f089f18 100644 --- a/gwinc/__init__.py +++ b/gwinc/__init__.py @@ -132,7 +132,11 @@ def load_budget(name_or_path, freq=None, bname=None): inherit_budget = load_budget(inherit_ifo, freq=freq, bname=bname) pre_ifo = inherit_budget.ifo - pre_ifo.update(ifo, overwrite_atoms=False) + pre_ifo.update( + ifo, + overwrite_atoms=False, + clear_test=lambda v: isinstance(v, str) and v == '<unset>' + ) inherit_budget.update(ifo=pre_ifo) return inherit_budget else: diff --git a/test/inherit/Aplus_mod3.yaml b/test/inherit/Aplus_mod3.yaml new file mode 100644 index 0000000000000000000000000000000000000000..bc85ead6fba17302a66d0e78f9ae9204f5ea2cab --- /dev/null +++ b/test/inherit/Aplus_mod3.yaml @@ -0,0 +1,5 @@ ++inherit: 'Aplus' + +# test that unset removes struct entries +Optics: + Quadrature: <unset> \ No newline at end of file diff --git a/test/inherit/test_inherit.py b/test/inherit/test_inherit.py index b93e52afdb34ea31b1575a8c62507364007f920f..397b0ed3a4d2d6b6556992ba0ab2c0dc90b4bacc 100644 --- a/test/inherit/test_inherit.py +++ b/test/inherit/test_inherit.py @@ -36,6 +36,14 @@ def test_inherit_load(pprint, tpath_join, fpath_join): ]) ) + fpath3 = fpath_join('Aplus_mod3.yaml') + B_inherit3 = load_budget(fpath3) + pprint(B_inherit3.ifo.diff(B_orig.ifo)) + assert( + B_inherit3.ifo.diff(B_orig.ifo) + == [('Optics.Quadrature.dc', None, 1.5707963)] + ) + @pytest.mark.fast @pytest.mark.logic