Example #1
0
def test_pass_readonly_array():
    from pybind11_tests import fixed_copy_r, fixed_r, fixed_r_const
    z = np.full((5, 6), 42.0)
    z.flags.writeable = False
    np.testing.assert_array_equal(z, fixed_copy_r(z))
    np.testing.assert_array_equal(fixed_r_const(), fixed_r())
    assert not fixed_r_const().flags.writeable
    np.testing.assert_array_equal(fixed_copy_r(fixed_r_const()), fixed_r_const())
Example #2
0
def test_pass_readonly_array():
    from pybind11_tests import fixed_copy_r, fixed_r, fixed_r_const
    z = np.full((5, 6), 42.0)
    z.flags.writeable = False
    np.testing.assert_array_equal(z, fixed_copy_r(z))
    np.testing.assert_array_equal(fixed_r_const(), fixed_r())
    assert not fixed_r_const().flags.writeable
    np.testing.assert_array_equal(fixed_copy_r(fixed_r_const()), fixed_r_const())
Example #3
0
def test_fixed():
    from pybind11_tests import fixed_r, fixed_c, fixed_copy_r, fixed_copy_c

    assert_equal_ref(fixed_c())
    assert_equal_ref(fixed_r())
    assert_equal_ref(fixed_copy_r(fixed_r()))
    assert_equal_ref(fixed_copy_c(fixed_c()))
    assert_equal_ref(fixed_copy_r(fixed_c()))
    assert_equal_ref(fixed_copy_c(fixed_r()))
Example #4
0
def test_fixed():
    from pybind11_tests import fixed_r, fixed_c, fixed_copy_r, fixed_copy_c

    assert_equal_ref(fixed_c())
    assert_equal_ref(fixed_r())
    assert_equal_ref(fixed_copy_r(fixed_r()))
    assert_equal_ref(fixed_copy_c(fixed_c()))
    assert_equal_ref(fixed_copy_r(fixed_c()))
    assert_equal_ref(fixed_copy_c(fixed_r()))