Skip to content

Commit

Permalink
Use "entity list" in error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
lognaturel committed Sep 15, 2023
1 parent 0381770 commit c67c0aa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions pyxform/entities/entities_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,20 @@ def get_entity_declaration(

if dataset.startswith(constants.ENTITIES_RESERVED_PREFIX):
raise PyXFormError(
f"Invalid dataset name: '{dataset}' starts with reserved prefix {constants.ENTITIES_RESERVED_PREFIX}."
f"Invalid entity list name: '{dataset}' starts with reserved prefix {constants.ENTITIES_RESERVED_PREFIX}."
)

if "." in dataset:
raise PyXFormError(
f"Invalid dataset name: '{dataset}'. Dataset names may not include periods."
f"Invalid entity list name: '{dataset}'. Names may not include periods."
)

if not is_valid_xml_tag(dataset):
if isinstance(dataset, bytes):
dataset = dataset.encode("utf-8")

raise PyXFormError(
f"Invalid dataset name: '{dataset}'. Dataset names must begin with a letter, colon, or underscore. Other characters can include numbers or dashes."
f"Invalid entity list name: '{dataset}'. Names must begin with a letter, colon, or underscore. Other characters can include numbers or dashes."
)

if not ("label" in entity):
Expand Down
6 changes: 3 additions & 3 deletions tests/test_entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def test_dataset_with_reserved_prefix__errors(self):
""",
errored=True,
error__contains=[
"Invalid dataset name: '__sweet' starts with reserved prefix __."
"Invalid entity list name: '__sweet' starts with reserved prefix __."
],
)

Expand All @@ -77,7 +77,7 @@ def test_dataset_with_invalid_xml_name__errors(self):
""",
errored=True,
error__contains=[
"Invalid dataset name: '$sweet'. Dataset names must begin with a letter, colon, or underscore. Other characters can include numbers or dashes."
"Invalid entity list name: '$sweet'. Names must begin with a letter, colon, or underscore. Other characters can include numbers or dashes."
],
)

Expand All @@ -94,7 +94,7 @@ def test_dataset_with_period_in_name__errors(self):
""",
errored=True,
error__contains=[
"Invalid dataset name: 's.w.eet'. Dataset names may not include periods."
"Invalid entity list name: 's.w.eet'. Names may not include periods."
],
)

Expand Down

0 comments on commit c67c0aa

Please sign in to comment.