[mlir] don't match the text produced only in debug mode in Python tests
authorAlex Zinenko <zinenko@google.com>
Thu, 7 Jan 2021 10:29:17 +0000 (11:29 +0100)
committerAlex Zinenko <zinenko@google.com>
Thu, 7 Jan 2021 18:57:28 +0000 (19:57 +0100)
Some Python bindings tests were using FileCheck to match parts of the
error description produced only in the debug compilation mode. Remove
these parts (but keep the main message) to ensure tests also pass when
running them in the release compilation mode.

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D94221

mlir/test/Bindings/Python/ir_attributes.py
mlir/test/Bindings/Python/ir_operation.py

index ce85dc3..91b0a92 100644 (file)
@@ -371,7 +371,7 @@ def testArrayAttr():
     try:
       ArrayAttr.get([42])
     except RuntimeError as e:
-      # CHECK: Error: Invalid attribute when attempting to create an ArrayAttribute (Unable to cast Python instance of type <class 'int'> to C++ type 'mlir::python::PyAttribute')
+      # CHECK: Error: Invalid attribute when attempting to create an ArrayAttribute
       print("Error: ", e)
 run(testArrayAttr)
 
index ba54e83..034b28e 100644 (file)
@@ -566,17 +566,17 @@ def testCreateWithInvalidAttributes():
     try:
       Operation.create("module", attributes={None:StringAttr.get("name")})
     except Exception as e:
-      # CHECK: Invalid attribute key (not a string) when attempting to create the operation "module" (Unable to cast Python instance of type <class 'NoneType'> to C++ type
+      # CHECK: Invalid attribute key (not a string) when attempting to create the operation "module"
       print(e)
     try:
       Operation.create("module", attributes={42:StringAttr.get("name")})
     except Exception as e:
-      # CHECK: Invalid attribute key (not a string) when attempting to create the operation "module" (Unable to cast Python instance of type <class 'int'> to C++ type
+      # CHECK: Invalid attribute key (not a string) when attempting to create the operation "module"
       print(e)
     try:
       Operation.create("module", attributes={"some_key":ctx})
     except Exception as e:
-      # CHECK: Invalid attribute value for the key "some_key" when attempting to create the operation "module" (Unable to cast Python instance of type <class '_mlir.ir.Context'> to C++ type 'mlir::python::PyAttribute')
+      # CHECK: Invalid attribute value for the key "some_key" when attempting to create the operation "module"
       print(e)
     try:
       Operation.create("module", attributes={"some_key":None})