Skip to content

Commit a762987

Browse files
committed
Minor fix - Replacing ValueError with TypeError
1 parent 15aafb0 commit a762987

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

esdlvalidator/validation/functions/check_has_pair.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,19 @@ def execute(self):
2323

2424
property = self.args["property"]
2525
if not isinstance(property, str):
26-
raise ValueError(f"Invalid function argument. Argument 'property' should be a string, got {type(property)}.")
26+
raise TypeError(f"Invalid function argument. Argument 'property' should be a string, got {type(property)}.")
2727

2828
keyword = self.args["keyword"]
2929
if not isinstance(keyword, str):
30-
raise ValueError(f"Invalid function argument. Argument 'keyword' should be a string, got {type(keyword)}.")
30+
raise TypeError(f"Invalid function argument. Argument 'keyword' should be a string, got {type(keyword)}.")
3131

3232
properties = self.datasets.get("extracted_properties", {}).get(property)
3333
if properties is None:
3434
raise ValueError(f"Error retrieving property '{property}' from datasets.")
3535

3636
p = utils.get_attribute(self.value, property)
3737
if p is None or not isinstance(p, str):
38-
raise ValueError(f"Expect '{property}' to a string, got {type(p)}.")
38+
raise TypeError(f"Expect '{property}' to a string, got {type(p)}.")
3939

4040
msg = None
4141
if keyword in p:

esdlvalidator/validation/functions/check_property_uniqueness.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def execute(self):
2020

2121
property = self.args["property"]
2222
if not isinstance(property, str):
23-
raise ValueError(f"Invalid function argument. Argument 'property' should be a string, got {type(property)}")
23+
raise TypeError(f"Invalid function argument. Argument 'property' should be a string, got {type(property)}")
2424

2525
properties = self.datasets.get("extracted_properties", {}).get(property)
2626
if properties is None:

esdlvalidator/validation/functions/check_reference_count_in_range.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,18 @@ def execute(self):
2424

2525
referenceType = self.args["referenceType"]
2626
if not isinstance(referenceType, str):
27-
raise ValueError(f"Invalid function argument. Argument 'referenceType' should be a string, got {type(referenceType)}")
27+
raise TypeError(f"Invalid function argument. Argument 'referenceType' should be a string, got {type(referenceType)}")
2828

2929
min = self.args["min"]
3030
max = self.args["max"]
3131
if not isinstance(min, int) or not isinstance(max, int):
32-
raise ValueError(f"Invalid function argument. Argument 'min' or 'max' should be an integer, got {type(min)}, {type(max)}")
32+
raise TypeError(f"Invalid function argument. Argument 'min' or 'max' should be an integer, got {type(min)}, {type(max)}")
3333

3434
r = utils.get_attribute(self.value, referenceType)
3535
if r is None:
3636
raise ValueError(f"{self.value.id} ({self.value.name}) has no reference '{referenceType}'")
3737
if not isinstance(r, Iterable):
38-
raise ValueError(f"Reference '{referenceType}' is not iterable")
38+
raise TypeError(f"Reference '{referenceType}' is not iterable")
3939

4040
msg = None
4141
if len(r) > max:

0 commit comments

Comments
 (0)