From e681b130852bb7da6663ad9f791876c704ee6acf Mon Sep 17 00:00:00 2001 From: xumingkuan Date: Thu, 27 Feb 2020 13:43:50 -0500 Subject: [PATCH] Add tests for unsupported "compare" operators (#547) * Add tests for unsupported "compare" operators * Add tests for unsupported "compare" operators --- tests/python/test_compare.py | 49 +++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/tests/python/test_compare.py b/tests/python/test_compare.py index d921b18f418ad..47ad3a2108536 100644 --- a/tests/python/test_compare.py +++ b/tests/python/test_compare.py @@ -25,7 +25,6 @@ def func(): a[9] = c >= b a[10] = c == b a[11] = c != b - # a[12] = b is not c # not supported func() assert a[0] @@ -118,3 +117,51 @@ def func(): func() assert a[0] assert not a[1] + + +@ti.must_throw(ti.TaichiSyntaxError) +def test_is(): + b = ti.var(ti.i32, shape=()) + c = ti.var(ti.i32, shape=()) + + @ti.kernel + def func(): + a = b is c + + func() + + +@ti.must_throw(ti.TaichiSyntaxError) +def test_is_not(): + b = ti.var(ti.i32, shape=()) + c = ti.var(ti.i32, shape=()) + + @ti.kernel + def func(): + a = b is not c + + func() + + +@ti.must_throw(ti.TaichiSyntaxError) +def test_in(): + b = ti.var(ti.i32, shape=()) + c = ti.var(ti.i32, shape=()) + + @ti.kernel + def func(): + a = b in c + + func() + + +@ti.must_throw(ti.TaichiSyntaxError) +def test_not_in(): + b = ti.var(ti.i32, shape=()) + c = ti.var(ti.i32, shape=()) + + @ti.kernel + def func(): + a = b not in c + + func()