diff options
Diffstat (limited to 'ext/pybind11/tests/test_constants_and_functions.py')
-rw-r--r-- | ext/pybind11/tests/test_constants_and_functions.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/ext/pybind11/tests/test_constants_and_functions.py b/ext/pybind11/tests/test_constants_and_functions.py new file mode 100644 index 000000000..d13d3af1b --- /dev/null +++ b/ext/pybind11/tests/test_constants_and_functions.py @@ -0,0 +1,24 @@ + + +def test_constants(): + from pybind11_tests import some_constant + + assert some_constant == 14 + + +def test_function_overloading(): + from pybind11_tests import MyEnum, test_function + + assert test_function() == "test_function()" + assert test_function(7) == "test_function(7)" + assert test_function(MyEnum.EFirstEntry) == "test_function(enum=1)" + assert test_function(MyEnum.ESecondEntry) == "test_function(enum=2)" + + assert test_function(1, 1.0) == "test_function(int, float)" + assert test_function(2.0, 2) == "test_function(float, int)" + + +def test_bytes(): + from pybind11_tests import return_bytes, print_bytes + + assert print_bytes(return_bytes()) == "bytes[1 0 2 0]" |