[Mlir-commits] [mlir] d995c41 - [MLIR][Python] fix python_test.py to not use `is` for type hint (#160718)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Thu Sep 25 08:26:19 PDT 2025


Author: Maksim Levental
Date: 2025-09-25T08:26:15-07:00
New Revision: d995c413c6001360da153a6a04fd6e6cf5185364

URL: https://github.com/llvm/llvm-project/commit/d995c413c6001360da153a6a04fd6e6cf5185364
DIFF: https://github.com/llvm/llvm-project/commit/d995c413c6001360da153a6a04fd6e6cf5185364.diff

LOG: [MLIR][Python] fix python_test.py to not use `is` for type hint (#160718)

`is` causes the asserts to fail when the return hint is interpreted as 
`OpResult | OpResultList | test.SameVariadicResultSizeOpVFV`

Added: 
    

Modified: 
    mlir/test/python/dialects/python_test.py

Removed: 
    


################################################################################
diff  --git a/mlir/test/python/dialects/python_test.py b/mlir/test/python/dialects/python_test.py
index 761d22357f8f8..1194e32c960c8 100644
--- a/mlir/test/python/dialects/python_test.py
+++ b/mlir/test/python/dialects/python_test.py
@@ -904,7 +904,7 @@ def types(lst):
 
             assert (
                 typing.get_type_hints(test.same_variadic_result_vfv)["return"]
-                is Union[OpResult, OpResultList, test.SameVariadicResultSizeOpVFV]
+                == Union[OpResult, OpResultList, test.SameVariadicResultSizeOpVFV]
             )
             assert (
                 type(test.same_variadic_result_vfv([i[0], i[1]], i[2], [i[3], i[4]]))
@@ -992,7 +992,7 @@ def types(lst):
 
             assert (
                 typing.get_type_hints(test.results_variadic)["return"]
-                is Union[OpResult, OpResultList, test.ResultsVariadicOp]
+                == Union[OpResult, OpResultList, test.ResultsVariadicOp]
             )
             assert type(test.results_variadic([i[0]])) is OpResult
             op_res_variadic = test.ResultsVariadicOp([i[0]])
@@ -1003,7 +1003,7 @@ def types(lst):
             assert type(op_res_variadic.res) is OpResultList
 
 
-# CHECK-LABEL: TEST: testVariadicAndNormalRegion
+# CHECK-LABEL: TEST: testVariadicAndNormalRegionOp
 @run
 def testVariadicAndNormalRegionOp():
     with Context() as ctx, Location.unknown(ctx):


        


More information about the Mlir-commits mailing list