def test_exp_optional():
    from pybind11_tests import double_or_zero_exp, half_or_none_exp, test_nullopt_exp

    assert double_or_zero_exp(None) == 0
    assert double_or_zero_exp(42) == 84
    pytest.raises(TypeError, double_or_zero_exp, 'foo')

    assert half_or_none_exp(0) is None
    assert half_or_none_exp(42) == 21
    pytest.raises(TypeError, half_or_none_exp, 'foo')

    assert test_nullopt_exp() == 42
    assert test_nullopt_exp(None) == 42
    assert test_nullopt_exp(42) == 42
    assert test_nullopt_exp(43) == 43
def test_exp_optional():
    from pybind11_tests import double_or_zero_exp, half_or_none_exp, test_nullopt_exp

    assert double_or_zero_exp(None) == 0
    assert double_or_zero_exp(42) == 84
    pytest.raises(TypeError, double_or_zero_exp, 'foo')

    assert half_or_none_exp(0) is None
    assert half_or_none_exp(42) == 21
    pytest.raises(TypeError, half_or_none_exp, 'foo')

    assert test_nullopt_exp() == 42
    assert test_nullopt_exp(None) == 42
    assert test_nullopt_exp(42) == 42
    assert test_nullopt_exp(43) == 43
def test_exp_optional():
    from pybind11_tests import double_or_zero_exp, half_or_none_exp, test_nullopt_exp

    if double_or_zero_exp(None) != 0:
        raise AssertionError
    if double_or_zero_exp(42) != 84:
        raise AssertionError
    pytest.raises(TypeError, double_or_zero_exp, 'foo')

    if half_or_none_exp(0) is not None:
        raise AssertionError
    if half_or_none_exp(42) != 21:
        raise AssertionError
    pytest.raises(TypeError, half_or_none_exp, 'foo')

    if test_nullopt_exp() != 42:
        raise AssertionError
    if test_nullopt_exp(None) != 42:
        raise AssertionError
    if test_nullopt_exp(42) != 42:
        raise AssertionError
    if test_nullopt_exp(43) != 43:
        raise AssertionError