test_constants_and_functions.py 570 Bytes
Newer Older
Dean Moldovan's avatar
Dean Moldovan committed
1
2
3
4
5
6
7
8


def test_constants():
    from pybind11_tests import some_constant

    assert some_constant == 14


9
def test_function_overloading():
10
    from pybind11_tests import MyEnum, test_function
Dean Moldovan's avatar
Dean Moldovan committed
11

12
13
    assert test_function() == "test_function()"
    assert test_function(7) == "test_function(7)"
14
15
    assert test_function(MyEnum.EFirstEntry) == "test_function(enum=1)"
    assert test_function(MyEnum.ESecondEntry) == "test_function(enum=2)"
Dean Moldovan's avatar
Dean Moldovan committed
16
17


18
def test_bytes():
Dean Moldovan's avatar
Dean Moldovan committed
19
20
    from pybind11_tests import return_bytes, print_bytes

21
    assert print_bytes(return_bytes()) == "bytes[1 0 2 0]"