pybind11/tests
Jason Rhinelander f7f5bc8e37 Numpy: better compilation errors, long double support (#619)
* Clarify PYBIND11_NUMPY_DTYPE documentation

The current documentation and example reads as though
PYBIND11_NUMPY_DTYPE is a declarative macro along the same lines as
PYBIND11_DECLARE_HOLDER_TYPE, but it isn't.  The changes the
documentation and docs example to make it clear that you need to "call"
the macro.

* Add satisfies_{all,any,none}_of<T, Preds>

`satisfies_all_of<T, Pred1, Pred2, Pred3>` is a nice legibility-enhanced
shortcut for `is_all<Pred1<T>, Pred2<T>, Pred3<T>>`.

* Give better error message for non-POD dtype attempts

If you try to use a non-POD data type, you get difficult-to-interpret
compilation errors (about ::name() not being a member of an internal
pybind11 struct, among others), for which isn't at all obvious what the
problem is.

This adds a static_assert for such cases.

It also changes the base case from an empty struct to the is_pod_struct
case by no longer using `enable_if<is_pod_struct>` but instead using a
static_assert: thus specializations avoid the base class, POD types
work, and non-POD types (and unimplemented POD types like std::array)
get a more informative static_assert failure.

* Prefix macros with PYBIND11_

numpy.h uses unprefixed macros, which seems undesirable.  This prefixes
them with PYBIND11_ to match all the other macros in numpy.h (and
elsewhere).

* Add long double support

This adds long double and std::complex<long double> support for numpy
arrays.

This allows some simplification of the code used to generate format
descriptors; the new code uses fewer macros, instead putting the code as
different templated options; the template conditions end up simpler with
this because we are now supporting all basic C++ arithmetic types (and
so can use is_arithmetic instead of is_integral + multiple
different specializations).

In addition to testing that it is indeed working in the test script, it
also adds various offset and size calculations there, which
fixes the test failures under x86 compilations.
2017-01-31 17:00:15 +01:00
..
test_cmake_build Rename target from pybind11::pybind11 to pybind11::module 2016-12-19 16:34:48 +01:00
CMakeLists.txt use a more conservative mechanism to check for pytest 2017-01-04 08:00:17 -05:00
conftest.py WIP: PyPy support (#527) 2016-12-16 15:00:46 +01:00
constructor_stats.h WIP: PyPy support (#527) 2016-12-16 15:00:46 +01:00
object.h minor doc & style fixes 2016-09-06 13:02:29 +09:00
pybind11_tests.cpp Adds automatic casting on assignment of non-pyobject types (#551) 2016-12-12 23:42:52 +01:00
pybind11_tests.h Replace std::cout with py::print in tests 2016-09-07 01:25:27 +02:00
test_alias_initialization.cpp Implement py::init_alias<>() constructors 2016-09-09 03:04:09 -04:00
test_alias_initialization.py WIP: PyPy support (#527) 2016-12-16 15:00:46 +01:00
test_buffers.cpp WIP: PyPy support (#527) 2016-12-16 15:00:46 +01:00
test_buffers.py WIP: PyPy support (#527) 2016-12-16 15:00:46 +01:00
test_callbacks.cpp Add py::dict() keyword constructor 2016-09-06 16:41:50 +02:00
test_callbacks.py nicer error message for invalid function arguments 2016-09-19 13:43:43 +02:00
test_chrono.cpp Changed non system clocks to be time deltas 2016-09-13 20:40:28 +10:00
test_chrono.py Add checks to maintain a consistent Python code style and prevent bugs (#515) 2016-11-20 21:21:54 +01:00
test_class_args.cpp Support std::shared_ptr holder type out of the box 2016-10-20 16:19:58 +02:00
test_class_args.py Set maximum line length for Python style checker (#552) 2016-12-13 00:59:28 +01:00
test_constants_and_functions.cpp Support binding noexcept function/methods in C++17 2016-12-14 20:40:49 +01:00
test_constants_and_functions.py Support binding noexcept function/methods in C++17 2016-12-14 20:40:49 +01:00
test_copy_move_policies.cpp equals needed for test_copy_move_policies to build icpc 2016.3 (#507) 2016-11-17 11:01:11 +01:00
test_copy_move_policies.py Add checks to maintain a consistent Python code style and prevent bugs (#515) 2016-11-20 21:21:54 +01:00
test_docstring_options.cpp Provide more control over automatic generation of docstrings (#486) 2016-11-15 12:38:05 +01:00
test_docstring_options.py Add checks to maintain a consistent Python code style and prevent bugs (#515) 2016-11-20 21:21:54 +01:00
test_eigen.cpp Adds automatic casting on assignment of non-pyobject types (#551) 2016-12-12 23:42:52 +01:00
test_eigen.py Set maximum line length for Python style checker (#552) 2016-12-13 00:59:28 +01:00
test_enum.cpp make arithmetic operators of enum_ optional (#508) 2016-11-17 23:24:47 +01:00
test_enum.py Add checks to maintain a consistent Python code style and prevent bugs (#515) 2016-11-20 21:21:54 +01:00
test_eval_call.py Add checks to maintain a consistent Python code style and prevent bugs (#515) 2016-11-20 21:21:54 +01:00
test_eval.cpp Make error_already_set fetch and hold the Python error 2016-09-10 12:08:32 +02:00
test_eval.py Rewrite eval tests to allow for simple asserts 2016-08-19 16:31:48 +02:00
test_exceptions.cpp Adds automatic casting on assignment of non-pyobject types (#551) 2016-12-12 23:42:52 +01:00
test_exceptions.py Add checks to maintain a consistent Python code style and prevent bugs (#515) 2016-11-20 21:21:54 +01:00
test_inheritance.cpp Add check for matching holder_type when inheriting (#588) 2017-01-31 16:52:11 +01:00
test_inheritance.py Add check for matching holder_type when inheriting (#588) 2017-01-31 16:52:11 +01:00
test_issues.cpp Adds automatic casting on assignment of non-pyobject types (#551) 2016-12-12 23:42:52 +01:00
test_issues.py WIP: PyPy support (#527) 2016-12-16 15:00:46 +01:00
test_keep_alive.cpp Replace std::cout with py::print in tests 2016-09-07 01:25:27 +02:00
test_keep_alive.py WIP: PyPy support (#527) 2016-12-16 15:00:46 +01:00
test_kwargs_and_defaults.cpp Remove superseded handle::operator() overloads 2016-09-06 16:41:50 +02:00
test_kwargs_and_defaults.py nicer error message for invalid function arguments 2016-09-19 13:43:43 +02:00
test_methods_and_attributes.cpp disable dynamic attribute test on pypy 2016-12-26 13:54:47 +01:00
test_methods_and_attributes.py disable dynamic attribute test on pypy 2016-12-26 13:54:47 +01:00
test_modules.cpp Make test initialization self-registering 2016-09-03 17:34:41 -04:00
test_modules.py Simplify tests by replacing output capture with asserts where possible 2016-08-19 13:19:38 +02:00
test_multiple_inheritance.cpp WIP: PyPy support (#527) 2016-12-16 15:00:46 +01:00
test_multiple_inheritance.py WIP: PyPy support (#527) 2016-12-16 15:00:46 +01:00
test_numpy_array.cpp Improve consistency of array and array_t with regard to other pytypes 2016-11-17 08:55:42 +01:00
test_numpy_array.py WIP: PyPy support (#527) 2016-12-16 15:00:46 +01:00
test_numpy_dtypes.cpp Numpy: better compilation errors, long double support (#619) 2017-01-31 17:00:15 +01:00
test_numpy_dtypes.py Numpy: better compilation errors, long double support (#619) 2017-01-31 17:00:15 +01:00
test_numpy_vectorize.cpp Replace std::cout with py::print in tests 2016-09-07 01:25:27 +02:00
test_numpy_vectorize.py Set maximum line length for Python style checker (#552) 2016-12-13 00:59:28 +01:00
test_opaque_types.cpp Make test initialization self-registering 2016-09-03 17:34:41 -04:00
test_opaque_types.py Set maximum line length for Python style checker (#552) 2016-12-13 00:59:28 +01:00
test_operator_overloading.cpp Make test initialization self-registering 2016-09-03 17:34:41 -04:00
test_operator_overloading.py WIP: PyPy support (#527) 2016-12-16 15:00:46 +01:00
test_pickling.cpp fix segfault in test suite due to typo (fixes #586) 2017-01-04 15:05:20 +01:00
test_pickling.py WIP: PyPy support (#527) 2016-12-16 15:00:46 +01:00
test_python_types.cpp WIP: PyPy support (#527) 2016-12-16 15:00:46 +01:00
test_python_types.py Fix segfault when repr() with pybind11 type with metaclass (#571) 2016-12-26 11:25:42 +01:00
test_sequences_and_iterators.cpp Fix test compilation failure under gcc 4.9 (#496) 2016-11-13 10:41:31 +09:00
test_sequences_and_iterators.py Add checks to maintain a consistent Python code style and prevent bugs (#515) 2016-11-20 21:21:54 +01:00
test_smart_ptr.cpp always_construct_holder feature to support intrusively reference-counted types (#561) 2016-12-15 23:44:23 +01:00
test_smart_ptr.py always_construct_holder feature to support intrusively reference-counted types (#561) 2016-12-15 23:44:23 +01:00
test_stl_binders.cpp Change all_of_t/any_of_t to all_of/any_of, add none_of 2016-12-14 20:42:36 +01:00
test_stl_binders.py Add checks to maintain a consistent Python code style and prevent bugs (#515) 2016-11-20 21:21:54 +01:00
test_virtual_functions.cpp Update OVERLOAD macros to support ref/ptr return type overloads 2016-09-11 01:21:53 -04:00
test_virtual_functions.py WIP: PyPy support (#527) 2016-12-16 15:00:46 +01:00