Add test for a function accepting recarray (WIP)

This commit is contained in:
Ivan Smirnov
2016-06-21 21:05:29 +01:00
parent f5b166d042
commit 669e14269d
2 changed files with 31 additions and 1 deletions

View File

@@ -3,7 +3,8 @@ from __future__ import print_function
import numpy as np
from example import (
create_rec_simple, create_rec_packed, create_rec_nested, print_format_descriptors
create_rec_simple, create_rec_packed, create_rec_nested, print_format_descriptors,
print_rec_simple, print_rec_packed, print_rec_nested
)
@@ -28,6 +29,12 @@ for func, dtype in [(create_rec_simple, simple_dtype), (create_rec_packed, packe
check_eq(arr, [(False, 0, 0.0), (True, 1, 1.5), (False, 2, 3.0)], simple_dtype)
check_eq(arr, [(False, 0, 0.0), (True, 1, 1.5), (False, 2, 3.0)], packed_dtype)
# uncomment lines below to cause a segfault upon exit in Py_Finalize :(
# if dtype == simple_dtype:
# print_rec_simple(arr)
# else:
# print_rec_packed(arr)
nested_dtype = np.dtype([('a', simple_dtype), ('b', packed_dtype)])
@@ -40,3 +47,4 @@ assert arr.dtype == nested_dtype
check_eq(arr, [((False, 0, 0.0), (True, 1, 1.5)),
((True, 1, 1.5), (False, 2, 3.0)),
((False, 2, 3.0), (True, 3, 4.5))], nested_dtype)
# print_rec_nested(arr)