How to use the multimethod.signature function in multimethod

To help you get started, we’ve selected a few multimethod examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github coady / multimethod / tests / test_dispatch.py View on Github external
def test_signature():
    with pytest.raises(TypeError):
        signature([list]) <= signature([None])
github coady / multimethod / tests / test_methods.py View on Github external
def test_signature():
    assert signature([Any, List]) == (object, list)
    assert signature([AnyStr]) == signature([Union[bytes, str]])
    assert signature([List]) <= signature([list])
    assert signature([list]) <= signature([List])
    assert signature([list]) <= signature([List[int]])
    assert signature([List[int]]) - signature([list])
    assert signature([list]) - signature([List[int]]) == (1,)