diff --git a/src/caoscrawler/identifiable_adapters.py b/src/caoscrawler/identifiable_adapters.py index 9be469738d612e83a8706f8e38da0274d6166888..29dd97ffb20a05f3be0f755b62c3c2a161acd65a 100644 --- a/src/caoscrawler/identifiable_adapters.py +++ b/src/caoscrawler/identifiable_adapters.py @@ -197,7 +197,8 @@ class IdentifiableAdapter(metaclass=ABCMeta): "Multi properties used in identifiables could cause unpredictable results and are" " not allowed. You might want to consider a Property with a list as value.") - return Identifiable(record_type=registered_identifiable.parents[0].name, + return Identifiable(record_type=(registered_identifiable.parents[0].name + if registered_identifiable else None), name=record.name, properties=identifiable_props, path=record.path diff --git a/unittests/records.xml b/unittests/records.xml index 964d7d7e4128ba0a9fbbbe0cc82b1f2f40ee36db..bfd1be778c870dd86d3429bfc6ea98f629c4fcb4 100644 --- a/unittests/records.xml +++ b/unittests/records.xml @@ -1,157 +1,157 @@ <Entities> - <Record id="6224"> - <Version id="3a1a1e3ff801c1973f42d10f306fa1ee260382b1" head="true"/> - <Parent id="6193" name="Project"/> - <Property id="6190" name="date" description="date of the experiment" datatype="DATETIME" importance="FIX" flag="inheritance:FIX">2020</Property> - <Property id="6191" name="identifier" description="identifier of the experiment" datatype="TEXT" importance="FIX" flag="inheritance:FIX">climate-model-predict</Property> - </Record> - <Record id="6225" description="Code for fitting the predictive model to the training data and for predicting the average annual temperature for all measurement stations for the years 2010 to 2019"> - <Version id="8b93fa1c562f75090de8328ed3d60c42fad1e455" head="true"/> - <Parent id="6221" name="Measurement"/> - <Property id="6190" name="date" description="date of the experiment" datatype="DATETIME" importance="FIX" flag="inheritance:FIX">2020-02-01</Property> - <Property id="6191" name="identifier" description="identifier of the experiment" datatype="TEXT" importance="FIX" flag="inheritance:FIX"/> - <Property id="6193" name="project" datatype="Project" importance="FIX" flag="inheritance:FIX">6224</Property> - <Property id="6192" name="responsible" datatype="LIST<Person>" importance="FIX" flag="inheritance:FIX"> - <Value>6226</Value> + <Record id="7140"> + <Version id="d9e27cf2059289eb9c12c731d28a74e1f8cf740b" head="true"/> + <Parent id="7109" name="Project"/> + <Property id="7106" name="date" description="date of the experiment" datatype="DATETIME" importance="FIX" flag="inheritance:FIX">2020</Property> + <Property id="7107" name="identifier" description="identifier of the experiment" datatype="TEXT" importance="FIX" flag="inheritance:FIX">climate-model-predict</Property> + </Record> + <Record id="7141" description="Code for fitting the predictive model to the training data and for predicting the average annual temperature for all measurement stations for the years 2010 to 2019"> + <Version id="a9ffbd1c9d86cdf25d63c4b7f2789c0da8ee9bde" head="true"/> + <Parent id="7137" name="Measurement"/> + <Property id="7106" name="date" description="date of the experiment" datatype="DATETIME" importance="FIX" flag="inheritance:FIX">2020-02-01</Property> + <Property id="7107" name="identifier" description="identifier of the experiment" datatype="TEXT" importance="FIX" flag="inheritance:FIX"/> + <Property id="7109" name="project" datatype="Project" importance="FIX" flag="inheritance:FIX">7140</Property> + <Property id="7108" name="responsible" datatype="LIST<Person>" importance="FIX" flag="inheritance:FIX"> + <Value>7142</Value> </Property> </Record> - <Record id="6226"> - <Version id="de8df2e71a7c0c2bf83ba60bd513bd944b3a7a31" head="true"/> - <Parent id="6202" name="Person"/> - <Property id="6204" name="first_name" description="First name of a Person." datatype="TEXT" importance="FIX" flag="inheritance:FIX"/> - <Property id="6205" name="last_name" description="LastName of a Person." datatype="TEXT" importance="FIX" flag="inheritance:FIX">AuthorE</Property> - </Record> - <Record id="6227" description="Average temperatures of the years 2010-2019 as obtained from wheatherdata.example"> - <Version id="62ba2f5b3404504d024c9d2b0c1e2bab767cad5b" head="true"/> - <Parent id="6221" name="Measurement"/> - <Property id="6190" name="date" description="date of the experiment" datatype="DATETIME" importance="FIX" flag="inheritance:FIX">2010-01-01</Property> - <Property id="6191" name="identifier" description="identifier of the experiment" datatype="TEXT" importance="FIX" flag="inheritance:FIX"/> - <Property id="6193" name="project" datatype="Project" importance="FIX" flag="inheritance:FIX">6224</Property> - <Property id="6192" name="responsible" datatype="LIST<Person>" importance="FIX" flag="inheritance:FIX"> - <Value>6228</Value> + <Record id="7142"> + <Version id="b33885dfdfa2f2ad8aab3da4320b88bb46e39af1" head="true"/> + <Parent id="7118" name="Person"/> + <Property id="7120" name="first_name" description="First name of a Person." datatype="TEXT" importance="FIX" flag="inheritance:FIX"/> + <Property id="7121" name="last_name" description="LastName of a Person." datatype="TEXT" importance="FIX" flag="inheritance:FIX">AuthorE</Property> + </Record> + <Record id="7143" description="Average temperatures of the years 2010-2019 as obtained from wheatherdata.example"> + <Version id="1935653cc13b2cc7ecea8d3415a69119ec900d3f" head="true"/> + <Parent id="7137" name="Measurement"/> + <Property id="7106" name="date" description="date of the experiment" datatype="DATETIME" importance="FIX" flag="inheritance:FIX">2010-01-01</Property> + <Property id="7107" name="identifier" description="identifier of the experiment" datatype="TEXT" importance="FIX" flag="inheritance:FIX"/> + <Property id="7109" name="project" datatype="Project" importance="FIX" flag="inheritance:FIX">7140</Property> + <Property id="7108" name="responsible" datatype="LIST<Person>" importance="FIX" flag="inheritance:FIX"> + <Value>7144</Value> </Property> </Record> - <Record id="6228"> - <Version id="8ef17723704149e6df345b86e8021718d5711029" head="true"/> - <Parent id="6202" name="Person"/> - <Property id="6204" name="first_name" description="First name of a Person." datatype="TEXT" importance="FIX" flag="inheritance:FIX"/> - <Property id="6205" name="last_name" description="LastName of a Person." datatype="TEXT" importance="FIX" flag="inheritance:FIX">AuthorD</Property> - </Record> - <Record id="6229" description="Average temperatures of the years 2000-2009 as obtained from wheatherdata.example"> - <Version id="03938d48e3fa031dd8ee2cd36d71033aefea9c85" head="true"/> - <Parent id="6221" name="Measurement"/> - <Property id="6190" name="date" description="date of the experiment" datatype="DATETIME" importance="FIX" flag="inheritance:FIX">2000-01-01</Property> - <Property id="6191" name="identifier" description="identifier of the experiment" datatype="TEXT" importance="FIX" flag="inheritance:FIX"/> - <Property id="6193" name="project" datatype="Project" importance="FIX" flag="inheritance:FIX">6224</Property> - <Property id="6192" name="responsible" datatype="LIST<Person>" importance="FIX" flag="inheritance:FIX"> - <Value>6228</Value> + <Record id="7144"> + <Version id="2a0aa1eded0a74926929fc486f6cc50f7cfc12ad" head="true"/> + <Parent id="7118" name="Person"/> + <Property id="7120" name="first_name" description="First name of a Person." datatype="TEXT" importance="FIX" flag="inheritance:FIX"/> + <Property id="7121" name="last_name" description="LastName of a Person." datatype="TEXT" importance="FIX" flag="inheritance:FIX">AuthorD</Property> + </Record> + <Record id="7145" description="Average temperatures of the years 2000-2009 as obtained from wheatherdata.example"> + <Version id="5a965d58f1f28675501d4afb3a58f2587a76ac8a" head="true"/> + <Parent id="7137" name="Measurement"/> + <Property id="7106" name="date" description="date of the experiment" datatype="DATETIME" importance="FIX" flag="inheritance:FIX">2000-01-01</Property> + <Property id="7107" name="identifier" description="identifier of the experiment" datatype="TEXT" importance="FIX" flag="inheritance:FIX"/> + <Property id="7109" name="project" datatype="Project" importance="FIX" flag="inheritance:FIX">7140</Property> + <Property id="7108" name="responsible" datatype="LIST<Person>" importance="FIX" flag="inheritance:FIX"> + <Value>7144</Value> </Property> </Record> - <Record id="6230" description="Average temperatures of the years 1990-1999 as obtained from wheatherdata.example"> - <Version id="3c07d9f8e1b7b943dc4a7cedecf7067b51bb07cd" head="true"/> - <Parent id="6221" name="Measurement"/> - <Property id="6190" name="date" description="date of the experiment" datatype="DATETIME" importance="FIX" flag="inheritance:FIX">1990-01-01</Property> - <Property id="6191" name="identifier" description="identifier of the experiment" datatype="TEXT" importance="FIX" flag="inheritance:FIX"/> - <Property id="6193" name="project" datatype="Project" importance="FIX" flag="inheritance:FIX">6224</Property> - <Property id="6192" name="responsible" datatype="LIST<Person>" importance="FIX" flag="inheritance:FIX"> - <Value>6228</Value> + <Record id="7146" description="Average temperatures of the years 1990-1999 as obtained from wheatherdata.example"> + <Version id="9f75883f0729557dc22129339264905b4ccdf76d" head="true"/> + <Parent id="7137" name="Measurement"/> + <Property id="7106" name="date" description="date of the experiment" datatype="DATETIME" importance="FIX" flag="inheritance:FIX">1990-01-01</Property> + <Property id="7107" name="identifier" description="identifier of the experiment" datatype="TEXT" importance="FIX" flag="inheritance:FIX"/> + <Property id="7109" name="project" datatype="Project" importance="FIX" flag="inheritance:FIX">7140</Property> + <Property id="7108" name="responsible" datatype="LIST<Person>" importance="FIX" flag="inheritance:FIX"> + <Value>7144</Value> </Property> </Record> - <Record id="6231" description="Average temperatures of the years 1980-1989 as obtained from wheatherdata.example"> - <Version id="b436049333159c2cafa2be46a3a701648465ae02" head="true"/> - <Parent id="6221" name="Measurement"/> - <Property id="6190" name="date" description="date of the experiment" datatype="DATETIME" importance="FIX" flag="inheritance:FIX">1980-01-01</Property> - <Property id="6191" name="identifier" description="identifier of the experiment" datatype="TEXT" importance="FIX" flag="inheritance:FIX"/> - <Property id="6193" name="project" datatype="Project" importance="FIX" flag="inheritance:FIX">6224</Property> - <Property id="6192" name="responsible" datatype="LIST<Person>" importance="FIX" flag="inheritance:FIX"> - <Value>6228</Value> + <Record id="7147" description="Average temperatures of the years 1980-1989 as obtained from wheatherdata.example"> + <Version id="93b859aa29d4e195cf809b80a181073a2675fdaa" head="true"/> + <Parent id="7137" name="Measurement"/> + <Property id="7106" name="date" description="date of the experiment" datatype="DATETIME" importance="FIX" flag="inheritance:FIX">1980-01-01</Property> + <Property id="7107" name="identifier" description="identifier of the experiment" datatype="TEXT" importance="FIX" flag="inheritance:FIX"/> + <Property id="7109" name="project" datatype="Project" importance="FIX" flag="inheritance:FIX">7140</Property> + <Property id="7108" name="responsible" datatype="LIST<Person>" importance="FIX" flag="inheritance:FIX"> + <Value>7144</Value> </Property> </Record> - <Record id="6232"> - <Version id="83ce2862516d844686edeac9bbd14c56463f8bd8" head="true"/> - <Parent id="6193" name="Project"/> - <Property id="6190" name="date" description="date of the experiment" datatype="DATETIME" importance="FIX" flag="inheritance:FIX">2020</Property> - <Property id="6191" name="identifier" description="identifier of the experiment" datatype="TEXT" importance="FIX" flag="inheritance:FIX">SpeedOfLight</Property> - </Record> - <Record id="6233" description="Radio interferometry measurements to determine the speed of light"> - <Version id="bc44aa56ba30d69a63ec8812624e5df3014b0824" head="true"/> - <Parent id="6221" name="Measurement"/> - <Property id="6190" name="date" description="date of the experiment" datatype="DATETIME" importance="FIX" flag="inheritance:FIX">2020-01-03</Property> - <Property id="6191" name="identifier" description="identifier of the experiment" datatype="TEXT" importance="FIX" flag="inheritance:FIX"/> - <Property id="6193" name="project" datatype="Project" importance="FIX" flag="inheritance:FIX">6232</Property> - <Property id="6192" name="responsible" datatype="LIST<Person>" importance="FIX" flag="inheritance:FIX"> - <Value>6235</Value> - <Value>6234</Value> + <Record id="7148"> + <Version id="ce381c0ea5dff7d18343b255a77c41ead8f25554" head="true"/> + <Parent id="7109" name="Project"/> + <Property id="7106" name="date" description="date of the experiment" datatype="DATETIME" importance="FIX" flag="inheritance:FIX">2020</Property> + <Property id="7107" name="identifier" description="identifier of the experiment" datatype="TEXT" importance="FIX" flag="inheritance:FIX">SpeedOfLight</Property> + </Record> + <Record id="7149" description="Radio interferometry measurements to determine the speed of light"> + <Version id="0b37dd79183540abcf3e8c21f64b578a80c840c2" head="true"/> + <Parent id="7137" name="Measurement"/> + <Property id="7106" name="date" description="date of the experiment" datatype="DATETIME" importance="FIX" flag="inheritance:FIX">2020-01-03</Property> + <Property id="7107" name="identifier" description="identifier of the experiment" datatype="TEXT" importance="FIX" flag="inheritance:FIX"/> + <Property id="7109" name="project" datatype="Project" importance="FIX" flag="inheritance:FIX">7148</Property> + <Property id="7108" name="responsible" datatype="LIST<Person>" importance="FIX" flag="inheritance:FIX"> + <Value>7151</Value> + <Value>7150</Value> </Property> </Record> - <Record id="6234"> - <Version id="432ba6a860d0bbb2968c45151876ac5c00fcb903" head="true"/> - <Parent id="6202" name="Person"/> - <Property id="6204" name="first_name" description="First name of a Person." datatype="TEXT" importance="FIX" flag="inheritance:FIX"/> - <Property id="6205" name="last_name" description="LastName of a Person." datatype="TEXT" importance="FIX" flag="inheritance:FIX">AuthorB</Property> - </Record> - <Record id="6235"> - <Version id="2d9b37614df38ca23b989dc81b1380b4b2954752" head="true"/> - <Parent id="6202" name="Person"/> - <Property id="6204" name="first_name" description="First name of a Person." datatype="TEXT" importance="FIX" flag="inheritance:FIX"/> - <Property id="6205" name="last_name" description="LastName of a Person." datatype="TEXT" importance="FIX" flag="inheritance:FIX">AuthorA</Property> - </Record> - <Record id="6236" description="Cavity resonance measurements for determining the speed of light"> - <Version id="7dcb25469b2f4a8b70ea0e6a00ddc364db0a1b68" head="true"/> - <Parent id="6221" name="Measurement"/> - <Property id="6190" name="date" description="date of the experiment" datatype="DATETIME" importance="FIX" flag="inheritance:FIX">2020-01-02</Property> - <Property id="6191" name="identifier" description="identifier of the experiment" datatype="TEXT" importance="FIX" flag="inheritance:FIX">Cavity</Property> - <Property id="6193" name="project" datatype="Project" importance="FIX" flag="inheritance:FIX">6232</Property> - <Property id="6192" name="responsible" datatype="LIST<Person>" importance="FIX" flag="inheritance:FIX"> - <Value>6235</Value> - <Value>6237</Value> + <Record id="7150"> + <Version id="e69f536f4f0d0b7bd25d2806a2de9b77276620b3" head="true"/> + <Parent id="7118" name="Person"/> + <Property id="7120" name="first_name" description="First name of a Person." datatype="TEXT" importance="FIX" flag="inheritance:FIX"/> + <Property id="7121" name="last_name" description="LastName of a Person." datatype="TEXT" importance="FIX" flag="inheritance:FIX">AuthorB</Property> + </Record> + <Record id="7151"> + <Version id="e799d9aa2851aa1ed573c2a67fbcae1c4e11fffc" head="true"/> + <Parent id="7118" name="Person"/> + <Property id="7120" name="first_name" description="First name of a Person." datatype="TEXT" importance="FIX" flag="inheritance:FIX"/> + <Property id="7121" name="last_name" description="LastName of a Person." datatype="TEXT" importance="FIX" flag="inheritance:FIX">AuthorA</Property> + </Record> + <Record id="7152" description="Cavity resonance measurements for determining the speed of light"> + <Version id="07954137c9def17413dc8a3dc10c1d1d34557df6" head="true"/> + <Parent id="7137" name="Measurement"/> + <Property id="7106" name="date" description="date of the experiment" datatype="DATETIME" importance="FIX" flag="inheritance:FIX">2020-01-02</Property> + <Property id="7107" name="identifier" description="identifier of the experiment" datatype="TEXT" importance="FIX" flag="inheritance:FIX">Cavity</Property> + <Property id="7109" name="project" datatype="Project" importance="FIX" flag="inheritance:FIX">7148</Property> + <Property id="7108" name="responsible" datatype="LIST<Person>" importance="FIX" flag="inheritance:FIX"> + <Value>7151</Value> + <Value>7153</Value> </Property> </Record> - <Record id="6237"> - <Version id="54cd067dcdf7b0175a582ff8eb4d86fa43b49450" head="true"/> - <Parent id="6202" name="Person"/> - <Property id="6204" name="first_name" description="First name of a Person." datatype="TEXT" importance="FIX" flag="inheritance:FIX"/> - <Property id="6205" name="last_name" description="LastName of a Person." datatype="TEXT" importance="FIX" flag="inheritance:FIX">AuthorC</Property> - </Record> - <Record id="6238" description="Time-of-flight measurements to determine the speed of light"> - <Version id="2b51061fa3ad2a234d51518140f698216c59adb6" head="true"/> - <Parent id="6221" name="Measurement"/> - <Property id="6190" name="date" description="date of the experiment" datatype="DATETIME" importance="FIX" flag="inheritance:FIX">2020-01-01</Property> - <Property id="6191" name="identifier" description="identifier of the experiment" datatype="TEXT" importance="FIX" flag="inheritance:FIX">TimeOfFlight</Property> - <Property id="6193" name="project" datatype="Project" importance="FIX" flag="inheritance:FIX">6232</Property> - <Property id="6192" name="responsible" datatype="LIST<Person>" importance="FIX" flag="inheritance:FIX"> - <Value>6235</Value> - <Value>6234</Value> + <Record id="7153"> + <Version id="6933ab496766b32d7fff35fb333e810ad2d7f67f" head="true"/> + <Parent id="7118" name="Person"/> + <Property id="7120" name="first_name" description="First name of a Person." datatype="TEXT" importance="FIX" flag="inheritance:FIX"/> + <Property id="7121" name="last_name" description="LastName of a Person." datatype="TEXT" importance="FIX" flag="inheritance:FIX">AuthorC</Property> + </Record> + <Record id="7154" description="Time-of-flight measurements to determine the speed of light"> + <Version id="6cd254d1187a591684585759a88664a2845e6103" head="true"/> + <Parent id="7137" name="Measurement"/> + <Property id="7106" name="date" description="date of the experiment" datatype="DATETIME" importance="FIX" flag="inheritance:FIX">2020-01-01</Property> + <Property id="7107" name="identifier" description="identifier of the experiment" datatype="TEXT" importance="FIX" flag="inheritance:FIX">TimeOfFlight</Property> + <Property id="7109" name="project" datatype="Project" importance="FIX" flag="inheritance:FIX">7148</Property> + <Property id="7108" name="responsible" datatype="LIST<Person>" importance="FIX" flag="inheritance:FIX"> + <Value>7151</Value> + <Value>7150</Value> </Property> </Record> - <Record id="6239" description="comparison between predicted and measured temperatures for 2010 to 2019"> - <Version id="fdaea3343ae504d1ef8bb97d995f564135520375" head="true"/> - <Parent id="6221" name="Measurement"/> - <Property id="6190" name="date" description="date of the experiment" datatype="DATETIME" importance="FIX" flag="inheritance:FIX">2020-02-08</Property> - <Property id="6191" name="identifier" description="identifier of the experiment" datatype="TEXT" importance="FIX" flag="inheritance:FIX">prediction-errors</Property> - <Property id="6193" name="project" datatype="Project" importance="FIX" flag="inheritance:FIX">6224</Property> - <Property id="6192" name="responsible" datatype="LIST<Person>" importance="FIX" flag="inheritance:FIX"> - <Value>6228</Value> + <Record id="7155" description="comparison between predicted and measured temperatures for 2010 to 2019"> + <Version id="c74e1541c6064898f168ca5a6ef94fb05603d9c0" head="true"/> + <Parent id="7137" name="Measurement"/> + <Property id="7106" name="date" description="date of the experiment" datatype="DATETIME" importance="FIX" flag="inheritance:FIX">2020-02-08</Property> + <Property id="7107" name="identifier" description="identifier of the experiment" datatype="TEXT" importance="FIX" flag="inheritance:FIX">prediction-errors</Property> + <Property id="7109" name="project" datatype="Project" importance="FIX" flag="inheritance:FIX">7140</Property> + <Property id="7108" name="responsible" datatype="LIST<Person>" importance="FIX" flag="inheritance:FIX"> + <Value>7144</Value> </Property> </Record> - <Record id="6240" description="Average over all data of each type of experiment separately and comined."> - <Version id="d14c013835ca8662f8b1aea363f34329e27ddd8e" head="true"/> - <Parent id="6221" name="Measurement"/> - <Property id="6190" name="date" description="date of the experiment" datatype="DATETIME" importance="FIX" flag="inheritance:FIX">2020-01-05</Property> - <Property id="6191" name="identifier" description="identifier of the experiment" datatype="TEXT" importance="FIX" flag="inheritance:FIX">average-all-exp-corr</Property> - <Property id="6193" name="project" datatype="Project" importance="FIX" flag="inheritance:FIX">6232</Property> - <Property id="6192" name="responsible" datatype="LIST<Person>" importance="FIX" flag="inheritance:FIX"> - <Value>6235</Value> + <Record id="7156" description="Average over all data of each type of experiment separately and comined."> + <Version id="e23dc9ef35bb9d064ac95886558a47d960daf8d7" head="true"/> + <Parent id="7137" name="Measurement"/> + <Property id="7106" name="date" description="date of the experiment" datatype="DATETIME" importance="FIX" flag="inheritance:FIX">2020-01-05</Property> + <Property id="7107" name="identifier" description="identifier of the experiment" datatype="TEXT" importance="FIX" flag="inheritance:FIX">average-all-exp-corr</Property> + <Property id="7109" name="project" datatype="Project" importance="FIX" flag="inheritance:FIX">7148</Property> + <Property id="7108" name="responsible" datatype="LIST<Person>" importance="FIX" flag="inheritance:FIX"> + <Value>7151</Value> </Property> </Record> - <Record id="6241" description="Average over all data of each type of experiment separately and comined."> - <Version id="6676e9597c9459af941b2cf76cd4cc066c608b94" head="true"/> - <Parent id="6221" name="Measurement"/> - <Property id="6190" name="date" description="date of the experiment" datatype="DATETIME" importance="FIX" flag="inheritance:FIX">2020-01-04</Property> - <Property id="6191" name="identifier" description="identifier of the experiment" datatype="TEXT" importance="FIX" flag="inheritance:FIX">average-all-exp</Property> - <Property id="6193" name="project" datatype="Project" importance="FIX" flag="inheritance:FIX">6232</Property> - <Property id="6192" name="responsible" datatype="LIST<Person>" importance="FIX" flag="inheritance:FIX"> - <Value>6235</Value> + <Record id="7157" description="Average over all data of each type of experiment separately and comined."> + <Version id="b962f6c03eeccb220a9edee85bee14fd5e61ab78" head="true"/> + <Parent id="7137" name="Measurement"/> + <Property id="7106" name="date" description="date of the experiment" datatype="DATETIME" importance="FIX" flag="inheritance:FIX">2020-01-04</Property> + <Property id="7107" name="identifier" description="identifier of the experiment" datatype="TEXT" importance="FIX" flag="inheritance:FIX">average-all-exp</Property> + <Property id="7109" name="project" datatype="Project" importance="FIX" flag="inheritance:FIX">7148</Property> + <Property id="7108" name="responsible" datatype="LIST<Person>" importance="FIX" flag="inheritance:FIX"> + <Value>7151</Value> </Property> </Record> </Entities> diff --git a/unittests/test_tool.py b/unittests/test_tool.py index 8911923576a10ad81846da3a31254d26d4b2e12b..fa61372199e666b93222f9d8d7b543fe01f8994f 100755 --- a/unittests/test_tool.py +++ b/unittests/test_tool.py @@ -582,24 +582,30 @@ def reset_mocks(mocks): def change_identifiable_prop(ident): - # the checks in here are only to make sure we change the record as we intend to - meas = ident._records[-2] - assert meas.parents[0].name == "Measurement" - resps = meas.properties[0] - assert resps.name == "date" - # change one element; This changes the date which is part of the identifiable - resps.value = "2022-01-04" + for ent in ident._records: + if len(ent.parents) == 0 or ent.parents[0].name != "Measurement": + continue + for prop in ent.properties: + if prop.name != "date": + continue + # change one element; This removes a responsible which is not part of the identifiable + prop.value = "2022-01-04" + return + raise RuntimeError("Did not find the property that should be changed.") def change_non_identifiable_prop(ident): - # the checks in here are only to make sure we change the record as we intend to - meas = ident._records[-1] - assert meas.parents[0].name == "Measurement" - resps = meas.properties[-1] - assert resps.name == "responsible" - assert len(resps.value) == 2 - # change one element; This removes a responsible which is not part of the identifiable - del resps.value[-1] + for ent in ident._records: + if len(ent.parents) == 0 or ent.parents[0].name != "Measurement": + continue + + for prop in ent.properties: + if prop.name != "responsible" or len(prop.value) < 2: + continue + # change one element; This removes a responsible which is not part of the identifiable + del prop.value[-1] + return + raise RuntimeError("Did not find the property that should be changed.") @patch("caoscrawler.crawl.Crawler._get_entity_by_id",