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)"
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)"
Example #3
0
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_function_overloading():
    from pybind11_tests import MyEnum, test_function

    if test_function() != "test_function()":
        raise AssertionError
    if test_function(7) != "test_function(7)":
        raise AssertionError
    if test_function(MyEnum.EFirstEntry) != "test_function(enum=1)":
        raise AssertionError
    if test_function(MyEnum.ESecondEntry) != "test_function(enum=2)":
        raise AssertionError

    if test_function(1, 1.0) != "test_function(int, float)":
        raise AssertionError
    if test_function(2.0, 2) != "test_function(float, int)":
        raise AssertionError