| 1 | from typing import Annotated |
| 2 | |
| 3 | import pytest |
| 4 | |
| 5 | from cyclopts import Parameter |
| 6 | from cyclopts.exceptions import UnknownOptionError |
| 7 | |
| 8 | |
| 9 | def test_allow_leading_hyphen_false(app): |
| 10 | @app.default |
| 11 | def foo(bar: Annotated[str, Parameter()]): |
| 12 | pass |
| 13 | |
| 14 | with pytest.raises(UnknownOptionError): |
| 15 | app("--buzz", exit_on_error=False, print_error=True) |
| 16 | |
| 17 | |
| 18 | def test_allow_leading_hyphen_true(app, assert_parse_args): |
| 19 | @app.default |
| 20 | def foo(bar: Annotated[str, Parameter(allow_leading_hyphen=True)]): |
| 21 | pass |
| 22 | |
| 23 | assert_parse_args(foo, "--buzz", bar="--buzz") |