Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[test] [bug] Fix master test failure by #1437 #1466

Merged
merged 1 commit into from
Jul 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions python/taichi/lang/impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,15 +217,16 @@ def get_runtime():

@taichi_scope
def make_constant_expr(val):
import numpy as np
_taichi_skip_traceback = 1
if isinstance(val, int):
if isinstance(val, (int, np.integer)):
if pytaichi.default_ip == i32:
return Expr(taichi_lang_core.make_const_expr_i32(val))
elif pytaichi.default_ip == i64:
return Expr(taichi_lang_core.make_const_expr_i64(val))
else:
assert False
elif isinstance(val, float):
elif isinstance(val, (float, np.floating, np.ndarray)):
if pytaichi.default_fp == f32:
return Expr(taichi_lang_core.make_const_expr_f32(val))
elif pytaichi.default_fp == f64:
Expand Down
4 changes: 2 additions & 2 deletions tests/python/test_numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ def test_numpy(arr: ti.ext_arr()):
assert a[i, j, k] == i * j * (k + 1) + i + j + k * 2


@ti.must_throw(AssertionError)
def test_numpy_3d():
@ti.must_throw(IndexError)
def test_numpy_3d_error():
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering who wrote this test... Its name overrides the previous one.

val = ti.var(ti.i32)

n = 4
Expand Down