Skip to content

Commit 1d8a684

Browse files
committed
add test
1 parent b7f1b13 commit 1d8a684

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test/legacy_test/test_math_op_patch_pir.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -703,6 +703,18 @@ def test_builtin_type_conversion(self):
703703
with self.assertRaises(TypeError):
704704
complex(x)
705705

706+
def test_builtin_type_conversion_old_ir(self):
707+
with paddle.pir_utils.DygraphOldIrGuard():
708+
_, _, program_guard = new_program()
709+
with program_guard:
710+
x = paddle.static.data(name='x', shape=[], dtype="float32")
711+
with self.assertRaises(TypeError):
712+
int(x)
713+
with self.assertRaises(TypeError):
714+
float(x)
715+
with self.assertRaises(TypeError):
716+
complex(x)
717+
706718
def test_math_exists(self):
707719
with paddle.pir_utils.IrGuard():
708720
a = paddle.static.data(name='a', shape=[1], dtype='float32')

0 commit comments

Comments
 (0)