mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-10-03 05:22:06 +00:00
Fix #4874. Checking restrictions of the wrong data type will now returned a failed result instead of an exception.
This commit is contained in:
@@ -1025,6 +1025,7 @@ class Restriction:
|
|||||||
if other is None:
|
if other is None:
|
||||||
return False
|
return False
|
||||||
for constraint, value in self.options.items():
|
for constraint, value in self.options.items():
|
||||||
|
try:
|
||||||
if constraint == "enumeration":
|
if constraint == "enumeration":
|
||||||
if other not in [cast_to_value(v, other) for v in value]:
|
if other not in [cast_to_value(v, other) for v in value]:
|
||||||
return False
|
return False
|
||||||
@@ -1056,6 +1057,8 @@ class Restriction:
|
|||||||
elif constraint == "minInclusive":
|
elif constraint == "minInclusive":
|
||||||
if float(other) < float(value):
|
if float(other) < float(value):
|
||||||
return False
|
return False
|
||||||
|
except ValueError:
|
||||||
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user