test_constants_and_functions.py revision 11986:c12e4625ab56
1 2 3def test_constants(): 4 from pybind11_tests import some_constant 5 6 assert some_constant == 14 7 8 9def test_function_overloading(): 10 from pybind11_tests import MyEnum, test_function 11 12 assert test_function() == "test_function()" 13 assert test_function(7) == "test_function(7)" 14 assert test_function(MyEnum.EFirstEntry) == "test_function(enum=1)" 15 assert test_function(MyEnum.ESecondEntry) == "test_function(enum=2)" 16 17 assert test_function(1, 1.0) == "test_function(int, float)" 18 assert test_function(2.0, 2) == "test_function(float, int)" 19 20 21def test_bytes(): 22 from pybind11_tests import return_bytes, print_bytes 23 24 assert print_bytes(return_bytes()) == "bytes[1 0 2 0]" 25