MCPcopy Create free account
hub / github.com/wjakob/nanobind / test27_python_array

Function test27_python_array

tests/test_ndarray.py:712–738  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

710
711
712def test27_python_array():
713 import array
714 a = array.array('d', [0, 0, 0, 3.14159, 0])
715 assert t.check(a)
716 assert t.check_rw_by_value(a)
717 assert a[1] == 1.414214
718 assert t.check_rw_by_value_float64(a)
719 assert a[2] == 2.718282
720 assert a[4] == 16.0
721 assert t.check_ro_by_value_ro(a)
722 assert t.check_ro_by_value_const_float64(a)
723
724 a[1] = 0.1
725 a[2] = 0.2
726 a[4] = 0.4
727 mv = memoryview(a)
728 assert t.check(mv)
729 assert t.check_rw_by_value(mv)
730 assert a[1] == 1.414214
731 assert t.check_rw_by_value_float64(mv)
732 assert a[2] == 2.718282
733 assert a[4] == 16.0
734 assert t.check_ro_by_value_ro(mv)
735 assert t.check_ro_by_value_const_float64(mv)
736
737 x = t.passthrough(a)
738 assert x is a
739
740
741def test27c_python_complex_array():

Callers

nothing calls this directly

Calls 1

memoryviewClass · 0.85

Tested by

no test coverage detected