Skip to content

Commit

Permalink
Adds KeyError for not accepted keys in Template
Browse files Browse the repository at this point in the history
  • Loading branch information
sherjeelshabih committed Dec 2, 2023
1 parent 8d8f0ee commit 295f72d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pynxtools/dataconverter/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,10 @@ def __getitem__(self, k):
return self.required[k]
except KeyError:
return self.undocumented[k]
return self.get_optionality(k)
if k in ("required", "optional", "recommended", "undocumented"):
return self.get_optionality(k)
raise KeyError("Only paths starting with '/' or one of [optional_parents, "
"lone_groups, required, optional, recommended, undocumented] can be used.")

def clear(self):
"""Clears all data stored in the Template object."""
Expand Down

0 comments on commit 295f72d

Please sign in to comment.