Esempio n. 1
0
def test_call_guard():
    assert m.unguarded_call() == "unguarded"
    assert m.guarded_call() == "guarded"

    assert m.multiple_guards_correct_order() == "guarded & guarded"
    assert m.multiple_guards_wrong_order() == "unguarded & guarded"

    if hasattr(m, "with_gil"):
        assert m.with_gil() == "GIL held"
        assert m.without_gil() == "GIL released"
Esempio n. 2
0
def test_call_guard():
    assert m.unguarded_call() == "unguarded"
    assert m.guarded_call() == "guarded"

    assert m.multiple_guards_correct_order() == "guarded & guarded"
    assert m.multiple_guards_wrong_order() == "unguarded & guarded"

    if hasattr(m, "with_gil"):
        assert m.with_gil() == "GIL held"
        assert m.without_gil() == "GIL released"
Esempio n. 3
0
def test_call_guard():
    from pybind11_tests import call_policies

    assert call_policies.unguarded_call() == "unguarded"
    assert call_policies.guarded_call() == "guarded"

    assert call_policies.multiple_guards_correct_order() == "guarded & guarded"
    assert call_policies.multiple_guards_wrong_order() == "unguarded & guarded"

    if hasattr(call_policies, "with_gil"):
        assert call_policies.with_gil() == "GIL held"
        assert call_policies.without_gil() == "GIL released"