core: improve demo tests for numpy factories

This commit is contained in:
lyken 2024-06-25 16:26:45 +08:00
parent e70d6f878c
commit a962a28d6d
1 changed files with 5 additions and 6 deletions

View File

@ -74,9 +74,6 @@ def consume_ndarray_1(n: ndarray[float, Literal[1]]):
def consume_ndarray_2(n: ndarray[float, Literal[2]]):
pass
def consume_ndarray_3(n: ndarray[float, Literal[3]]):
pass
def test_ndarray_ctor():
n: ndarray[float, Literal[1]] = np_ndarray([1])
consume_ndarray_1(n)
@ -94,8 +91,9 @@ def test_ndarray_empty():
n4: ndarray[float, 2] = np_empty((4, 4))
consume_ndarray_2(n4)
n5: ndarray[float, 3] = np_empty((4, 4, 4))
consume_ndarray_3(n5)
dim4 = (5, 2)
n5: ndarray[float, 2] = np_empty(dim4)
consume_ndarray_2(n5)
def test_ndarray_zeros():
n1: ndarray[float, 1] = np_zeros([1])
@ -108,7 +106,8 @@ def test_ndarray_zeros():
n3: ndarray[float, 1] = np_zeros((k * 2,))
output_ndarray_float_1(n3)
n4: ndarray[float, 2] = np_zeros((k * k, k * k))
dim4 = (3, 2 * k)
n4: ndarray[float, 2] = np_zeros(dim4)
output_ndarray_float_2(n4)
def test_ndarray_ones():