From c8caa23dccd6f82d64b106133ab3206abee656c8 Mon Sep 17 00:00:00 2001 From: "Jonathan Thorpe (Sony)" Date: Wed, 15 Nov 2023 15:42:55 +0000 Subject: [PATCH] Fix constraint violation error message (cherry picked from commit c5d43f79ede43b800b3b36c4a6072d426d4ccbfc) --- nmostesting/suites/IS1201Test.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/nmostesting/suites/IS1201Test.py b/nmostesting/suites/IS1201Test.py index c8ab9161..5d037a75 100644 --- a/nmostesting/suites/IS1201Test.py +++ b/nmostesting/suites/IS1201Test.py @@ -1456,21 +1456,22 @@ def check_constraint(self, test, constraint, type_name, is_sequence, test_metada context + ": defaultValue ") datatype = self.resolve_datatype(test, type_name) - constraint_type = "NcPropertyConstraintsNumber" \ - if constraint.get("propertyId") else "NcParameterConstraintsNumber" - # check NcXXXConstraintsNumber if constraint.get("minimum") or constraint.get("maximum") or constraint.get("step"): + constraint_type = "NcPropertyConstraintsNumber" \ + if constraint.get("propertyId") else "NcParameterConstraintsNumber" if datatype not in ["NcInt16", "NcInt32", "NcInt64", "NcUint16", "NcUint32", "NcUint64", "NcFloat32", "NcFloat64"]: test_metadata["error"] = True - test_metadata["error_msg"] = context + " of type " + datatype + \ + test_metadata["error_msg"] = context + ". " + datatype + \ " can not be constrainted by " + constraint_type + "." # check NcXXXConstraintsString if constraint.get("maxCharacters") or constraint.get("pattern"): + constraint_type = "NcPropertyConstraintsString" \ + if constraint.get("propertyId") else "NcParameterConstraintsString" if datatype not in ["NcString"]: test_metadata["error"] = True - test_metadata["error_msg"] = context + "of type " + datatype + \ + test_metadata["error_msg"] = context + ". " + datatype + \ " can not be constrainted by " + constraint_type + "." def do_validate_runtime_constraints_test(self, test, nc_object, class_manager, context=""):