Ver Fonte

Make validation pass / failures easier to read

nosoop há 10 meses atrás
pai
commit
f08a232202
2 ficheiros alterados com 3 adições e 3 exclusões
  1. 2 2
      src/smgdc/app.py
  2. 1 1
      src/smgdc/validate.py

+ 2 - 2
src/smgdc/app.py

@@ -41,9 +41,9 @@ def main() -> None:
 
         try:
             for key, result in entry.process(target).items():
-                print(key.substitute(name=name), "=", result)
+                print("- [OK]", key.substitute(name=name), "=", result)
         except Exception as e:
-            print(name, f"failed ({type(e)}):", e)
+            print("- [FAIL]", name, f"({type(e).__name__}):", e)
 
 
 if __name__ == "__main__":

+ 1 - 1
src/smgdc/validate.py

@@ -226,7 +226,7 @@ class ValueReadEntry(LocationEntry, tag="value", kw_only=True):
 
         # run assertion to ensure value is expected
         if self.assert_stmt and not self.assert_stmt.eval(value=result, **eval_functions):
-            raise AssertionError(f"Assertion failed: '{self.assert_stmt}' for value {result}")
+            raise AssertionError(f"'{self.assert_stmt}' failed for value {result}")
         return {
             KEY_AS_IS: result,
             KEY_SUFFIX("OFFSET"): self.offset_fmt.format_value(self.offset),