diff --git a/tests/python/unittest/test_ir_container.py b/tests/python/unittest/test_ir_container.py index 61a5381e5e47f..bcd16ff8cf1c9 100644 --- a/tests/python/unittest/test_ir_container.py +++ b/tests/python/unittest/test_ir_container.py @@ -14,6 +14,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. +import pytest import tvm from tvm import te import numpy as np @@ -36,17 +37,14 @@ def test_array_save_load_json(): def test_dir_array(): a = tvm.runtime.convert([1, 2, 3]) - dir(a) + assert dir(a) def test_getattr_array(): a = tvm.runtime.convert([1, 2, 3]) type_key = getattr(a, "type_key") assert type_key == "Array" - try: - getattr(a, "test_key") - except AttributeError: - pass + assert not hasattr(a, "test_key") def test_map(): @@ -89,7 +87,7 @@ def test_dir_map(): a = te.var("a") b = te.var("b") amap = tvm.runtime.convert({a: 2, b: 3}) - dir(amap) + assert dir(amap) def test_getattr_map(): @@ -98,10 +96,7 @@ def test_getattr_map(): amap = tvm.runtime.convert({a: 2, b: 3}) type_key = getattr(amap, "type_key") assert type_key == "Map" - try: - getattr(amap, "test_key") - except AttributeError: - pass + assert not hasattr(amap, "test_key") def test_in_container(): @@ -120,15 +115,5 @@ def test_ndarray_container(): if __name__ == "__main__": - test_str_map() - test_array() - test_map() - test_array_save_load_json() - test_map_save_load_json() - test_dir_array() - test_dir_map() - test_getattr_array() - test_getattr_map() - test_in_container() - test_ndarray_container() - + pytest.main([__file__]) +