Skip to content

Commit

Permalink
More meta tests for test_signatures.py
Browse files Browse the repository at this point in the history
  • Loading branch information
honno committed Apr 13, 2022
1 parent 447ecea commit 715838a
Showing 1 changed file with 43 additions and 2 deletions.
45 changes: 43 additions & 2 deletions array_api_tests/meta/test_signatures.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,52 @@
from inspect import signature
from inspect import Parameter, Signature, signature

import pytest

from ..test_signatures import _test_inspectable_func


@pytest.mark.xfail("not implemented")
def stub(foo, /, bar=None, *, baz=None):
pass


stub_sig = signature(stub)


def test_does_not_raise_on_interopable_kw_arg():
def stub_without_kwonly(foo, /, bar=None, baz=None):
pass

_test_inspectable_func(
signature(stub_without_kwonly),
stub_sig,
)


@pytest.mark.parametrize(
"sig",
[
Signature(
[
Parameter("foo", Parameter.POSITIONAL_ONLY),
Parameter("bar", Parameter.POSITIONAL_ONLY),
Parameter("baz", Parameter.KEYWORD_ONLY),
]
),
Signature(
[
Parameter("foo", Parameter.POSITIONAL_ONLY),
Parameter("bar", Parameter.KEYWORD_ONLY),
Parameter("baz", Parameter.KEYWORD_ONLY),
]
),
],
)
def test_raises_on_bad_sig(sig):
with pytest.raises(AssertionError):
_test_inspectable_func(sig, stub_sig)


@pytest.mark.xfail(reason="not implemented")
def test_kwonly():
def func(*, foo=None, bar=None):
pass
Expand Down

0 comments on commit 715838a

Please sign in to comment.