@@ -234,6 +234,139 @@ def listify_template(data_dict: Template):
234234@pytest .mark .parametrize (
235235 "data_dict,error_messages" ,
236236 [
237+ pytest .param (
238+ alter_dict (
239+ TEMPLATE ,
240+ "/ENTRY[my_entry]/NOTE[required_group2]/description" ,
241+ "an additional description" ,
242+ ),
243+ [
244+ "The key '/ENTRY[my_entry]/NOTE[required_group2]/description' uses the valid concept name 'NOTE', "
245+ "but there is another valid key /ENTRY[my_entry]/required_group2/description that uses the non-variadic "
246+ "name of the node.'" ,
247+ "The key /ENTRY[my_entry]/NOTE[required_group2]/description will not be written." ,
248+ ],
249+ id = "same-concept-with-and-without-concept-name" ,
250+ ),
251+ pytest .param (
252+ alter_dict (
253+ alter_dict (
254+ alter_dict (
255+ alter_dict (
256+ alter_dict (
257+ TEMPLATE ,
258+ "/ENTRY[my_entry]/SAMPLE[some_name]/name" ,
259+ "A sample name" ,
260+ ),
261+ "/ENTRY[my_entry]/SAMPLE[some_name]/description" ,
262+ "A sample description" ,
263+ ),
264+ "/ENTRY[my_entry]/USER[some_name]/name" ,
265+ "A user name" ,
266+ ),
267+ "/ENTRY[my_entry]/MONITOR[some_name]/name" ,
268+ "A monitor name" ,
269+ ),
270+ "/ENTRY[my_entry]/MONITOR[some_name]/description" ,
271+ "A monitor description" ,
272+ ),
273+ [
274+ "Instance name 'some_name' used for multiple different concepts: MONITOR, SAMPLE, USER. "
275+ "The following keys are affected: /ENTRY[my_entry]/MONITOR[some_name]/description, "
276+ "/ENTRY[my_entry]/MONITOR[some_name]/name, /ENTRY[my_entry]/SAMPLE[some_name]/description, "
277+ "/ENTRY[my_entry]/SAMPLE[some_name]/name, /ENTRY[my_entry]/USER[some_name]/name." ,
278+ "The key /ENTRY[my_entry]/MONITOR[some_name]/description will not be written." ,
279+ "The key /ENTRY[my_entry]/MONITOR[some_name]/name will not be written." ,
280+ "The key /ENTRY[my_entry]/SAMPLE[some_name]/description will not be written." ,
281+ "The key /ENTRY[my_entry]/SAMPLE[some_name]/name will not be written." ,
282+ "The key /ENTRY[my_entry]/USER[some_name]/name will not be written." ,
283+ ],
284+ id = "variadic-groups-of-the-same-name" ,
285+ ),
286+ pytest .param (
287+ alter_dict (
288+ alter_dict (
289+ alter_dict (
290+ TEMPLATE ,
291+ "/ENTRY[my_entry]/INSTRUMENT[instrument]/APERTURE[another_name]/name" ,
292+ "An aperture within an instrument" ,
293+ ),
294+ "/ENTRY[my_entry]/INSTRUMENT[instrument]/DETECTOR[another_name]/name" ,
295+ "A detector within an instrument" ,
296+ ),
297+ "/ENTRY[my_entry]/INSTRUMENT[instrument]/SOURCE[my_source]/APERTURE[another_name]/name" ,
298+ "An aperture within a source inside an instrument" ,
299+ ),
300+ [
301+ "Instance name 'another_name' used for multiple different concepts: APERTURE, DETECTOR. "
302+ "The following keys are affected: /ENTRY[my_entry]/INSTRUMENT[instrument]/APERTURE[another_name]/name, "
303+ "/ENTRY[my_entry]/INSTRUMENT[instrument]/DETECTOR[another_name]/name." ,
304+ "The key /ENTRY[my_entry]/INSTRUMENT[instrument]/APERTURE[another_name]/name will not be written." ,
305+ "The key /ENTRY[my_entry]/INSTRUMENT[instrument]/DETECTOR[another_name]/name will not be written." ,
306+ ],
307+ id = "variadic-groups-of-the-same-name-but-at-different-levels" ,
308+ ),
309+ pytest .param (
310+ alter_dict (
311+ alter_dict (
312+ alter_dict (
313+ alter_dict (
314+ alter_dict (
315+ alter_dict (
316+ TEMPLATE ,
317+ "/ENTRY[my_entry]/USER[user]/name" ,
318+ "A user name" ,
319+ ),
320+ "/ENTRY[my_entry]/USER[user]/role" ,
321+ "A user role" ,
322+ ),
323+ "/ENTRY[my_entry]/USER[user]/affiliation" ,
324+ "A user affiliation" ,
325+ ),
326+ "/ENTRY[my_entry]/ILLEGAL[user]/name" ,
327+ "An illegal user name" ,
328+ ),
329+ "/ENTRY[my_entry]/ILLEGAL[user]/role" ,
330+ "An illegal user role" ,
331+ ),
332+ "/ENTRY[my_entry]/ILLEGAL[user]/affiliation" ,
333+ "An illegal user affiliation" ,
334+ ),
335+ [
336+ "Instance name 'user' used for multiple different concepts: ILLEGAL, USER. "
337+ "The following keys are affected: /ENTRY[my_entry]/ILLEGAL[user]/affiliation, /ENTRY[my_entry]/ILLEGAL[user]/name, "
338+ "/ENTRY[my_entry]/ILLEGAL[user]/role, /ENTRY[my_entry]/USER[user]/affiliation, /ENTRY[my_entry]/USER[user]/name, "
339+ "/ENTRY[my_entry]/USER[user]/role." ,
340+ "The key /ENTRY[my_entry]/ILLEGAL[user]/affiliation will not be written." ,
341+ "The key /ENTRY[my_entry]/ILLEGAL[user]/name will not be written." ,
342+ "The key /ENTRY[my_entry]/ILLEGAL[user]/role will not be written." ,
343+ ],
344+ id = "variadic-groups-of-the-same-name-illegal-concept-multiple-fields" ,
345+ ),
346+ pytest .param (
347+ alter_dict (
348+ alter_dict (
349+ alter_dict (
350+ TEMPLATE ,
351+ "/ENTRY[my_entry]/USER[user]/name" ,
352+ "A user name" ,
353+ ),
354+ "/ENTRY[my_entry]/USERS[user]/name" ,
355+ "An invalid group of the same name" ,
356+ ),
357+ "/ENTRY[my_entry]/SAMPLE[user]/name" ,
358+ "A sample group called user with a name" ,
359+ ),
360+ [
361+ "Instance name 'user' used for multiple different concepts: SAMPLE, USER, USERS. "
362+ "The following keys are affected: /ENTRY[my_entry]/SAMPLE[user]/name, "
363+ "/ENTRY[my_entry]/USERS[user]/name, /ENTRY[my_entry]/USER[user]/name." ,
364+ "The key /ENTRY[my_entry]/USERS[user]/name will not be written." ,
365+ "The key /ENTRY[my_entry]/SAMPLE[user]/name will not be written." ,
366+ "The key /ENTRY[my_entry]/USER[user]/name will not be written." ,
367+ ],
368+ id = "variadic-groups-of-the-same-name-mix-of-valid-and-illegal-concepts" ,
369+ ),
237370 pytest .param (
238371 alter_dict (
239372 alter_dict (
@@ -1079,11 +1212,11 @@ def listify_template(data_dict: Template):
10791212 pytest .param (
10801213 alter_dict (
10811214 TEMPLATE ,
1082- "/ENTRY[my_entry]/INSTRUMENT[my_instrument]/ILLEGAL[my_source ]/type" ,
1215+ "/ENTRY[my_entry]/INSTRUMENT[my_instrument]/ILLEGAL[my_source2 ]/type" ,
10831216 1 ,
10841217 ),
10851218 [
1086- "Field /ENTRY[my_entry]/INSTRUMENT[my_instrument]/ILLEGAL[my_source ]/type written without documentation."
1219+ "Field /ENTRY[my_entry]/INSTRUMENT[my_instrument]/ILLEGAL[my_source2 ]/type written without documentation."
10871220 ],
10881221 id = "bad-namefitting" ,
10891222 ),
0 commit comments