Skip to content

Commit bfdc408

Browse files
erykoffTallJimbo
authored andcommitted
Rename functions.
1 parent 6d7b01d commit bfdc408

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

tests/pybind11_test.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,16 @@ def testStrideHandling(self):
4141
# the zero shape array tests are simply checking that pybind11 can handle
4242
# arbitrary strides (non-zero for length 1 array, zero for length 0 array
4343
# for numpy >= 1.23).
44-
pybind11_test_mod.acceptZeroShapeArray10(array)
45-
pybind11_test_mod.acceptZeroShapeArray11(array)
44+
pybind11_test_mod.acceptAnyArray10(array)
45+
pybind11_test_mod.acceptAnyArray11(array)
4646
array = numpy.zeros(0, dtype=float)
47-
pybind11_test_mod.acceptZeroShapeArray10(array)
48-
pybind11_test_mod.acceptZeroShapeArray11(array)
47+
pybind11_test_mod.acceptAnyArray10(array)
48+
pybind11_test_mod.acceptAnyArray11(array)
4949
# test that we gracefully fail when the strides are no multiples of the itemsize
5050
dtype = numpy.dtype([("f1", numpy.float64), ("f2", numpy.int16)])
5151
table = numpy.zeros(3, dtype=dtype)
52-
self.assertRaises(TypeError, pybind11_test_mod.acceptArray10, table['f1'])
52+
self.assertRaises(TypeError, pybind11_test_mod.acceptAnyArray10, table['f1'])
53+
self.assertRaises(TypeError, pybind11_test_mod.acceptAnyArray11, table['f1'])
5354

5455
def testNone(self):
5556
array = numpy.zeros(10, dtype=float)
@@ -62,7 +63,8 @@ def testNonNativeByteOrder(self):
6263
d2 = numpy.dtype(">f8")
6364
nonnative = d2 if d1 == numpy.dtype(float) else d1
6465
a = numpy.zeros(5, dtype=nonnative)
65-
self.assertRaises(TypeError, pybind11_test_mod.acceptArray10, a)
66+
self.assertRaises(TypeError, pybind11_test_mod.acceptAnyArray10, a)
67+
self.assertRaises(TypeError, pybind11_test_mod.acceptAnyArray11, a)
6668

6769

6870
if __name__ == "__main__":

tests/pybind11_test_mod.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ bool acceptArray1(ndarray::Array<double,1,1> const & a1) {
3939
#endif
4040
}
4141

42-
void acceptZeroShapeArray10(ndarray::Array<double,1,0> const & a1) {}
42+
void acceptAnyArray10(ndarray::Array<double,1,0> const & a1) {}
4343

44-
void acceptZeroShapeArray11(ndarray::Array<double,1,1> const & a1) {}
44+
void acceptAnyArray11(ndarray::Array<double,1,1> const & a1) {}
4545

4646
bool acceptArray3(ndarray::Array<double,3> const & a1) {
4747
ndarray::Array<double,3> a2 = returnArray3();
@@ -71,8 +71,8 @@ PYBIND11_MODULE(pybind11_test_mod, mod) {
7171
mod.def("returnArray3", returnArray3);
7272
mod.def("returnConstArray3", returnConstArray3);
7373
mod.def("acceptArray1", acceptArray1);
74-
mod.def("acceptZeroShapeArray10", acceptZeroShapeArray10);
75-
mod.def("acceptZeroShapeArray11", acceptZeroShapeArray11);
74+
mod.def("acceptAnyArray10", acceptAnyArray10);
75+
mod.def("acceptAnyArray11", acceptAnyArray11);
7676
mod.def("acceptArray3", acceptArray3);
7777
mod.def("acceptNoneArray", acceptNoneArray, "array"_a = nullptr);
7878
}

0 commit comments

Comments
 (0)