Skip to content

Commit

Permalink
[test] [bug] Fix master test failure by #1437 (#1466)
Browse files Browse the repository at this point in the history
  • Loading branch information
archibate authored Jul 11, 2020
1 parent 846fc15 commit 20e0496
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
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():
val = ti.var(ti.i32)

n = 4
Expand Down

0 comments on commit 20e0496

Please sign in to comment.