| 710 | |
| 711 | |
| 712 | def 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 | |
| 741 | def test27c_python_complex_array(): |