From 9a74fbcb85a948ad7a85a2277202e42a5b14346f Mon Sep 17 00:00:00 2001 From: David Almeida Date: Wed, 13 Nov 2024 14:13:39 +0100 Subject: [PATCH] Shorten error message --- nomenclature/definition.py | 2 +- tests/test_cli.py | 2 +- tests/test_definition.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/nomenclature/definition.py b/nomenclature/definition.py index 0bd08ccc..66837302 100644 --- a/nomenclature/definition.py +++ b/nomenclature/definition.py @@ -69,7 +69,7 @@ def __init__(self, path, dimensions=None): or [x.stem for x in path.iterdir() if x.is_dir()] ) if not self.dimensions: - raise ValueError("No dimensions specified in data structure.") + raise ValueError("No dimensions specified.") for dim in self.dimensions: codelist_cls = SPECIAL_CODELIST.get(dim, CodeList) diff --git a/tests/test_cli.py b/tests/test_cli.py index ed67b9d9..47dafc24 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -306,7 +306,7 @@ def test_cli_empty_definitions_dir(): assert cli_result.exit_code == 1 assert isinstance(cli_result.exception, ValueError) - assert "No dimensions specified in data structure." in str(cli_result.exception) + assert "No dimensions specified." in str(cli_result.exception) def test_check_region_aggregation(tmp_path): diff --git a/tests/test_definition.py b/tests/test_definition.py index 6e7b795b..6f0ac793 100644 --- a/tests/test_definition.py +++ b/tests/test_definition.py @@ -34,7 +34,7 @@ def test_nonexisting_path_raises(): def test_empty_codelist_raises(): """Check that initializing a DataStructureDefinition with empty CodeList raises""" - match = "No dimensions specified in data structure." + match = "No dimensions specified." with pytest.raises(ValueError, match=match): DataStructureDefinition(TEST_DATA_DIR / "codelist" / "simple_codelist")