| 1 |
from inspect import signature, Signature, Parameter |
| 2 |
import pytest |
| 3 |
from autocommand.autoparse import KWArgError, PositionalArgError, make_parser |
| 4 |
|
| 5 |
|
| 6 |
def test_kwargs(check_parse): |
| 7 |
def func(**kwargs): pass |
| 8 |
|
| 9 |
with pytest.raises(KWArgError): |
| 10 |
make_parser(signature(func), "", "", False) |
| 11 |
|
| 12 |
|
| 13 |
def test_positional(check_parse): |
| 14 |
# We have to fake this one, because it isn't possible to create a |
| 15 |
# positional-only parameter in pure python |
| 16 |
|
| 17 |
with pytest.raises(PositionalArgError): |
| 18 |
make_parser( |
| 19 |
Signature([Parameter('arg', Parameter.POSITIONAL_ONLY)]), |
| 20 |
"", "", False) |