File: test_version_parameter.py

package info (click to toggle)
python-cyclopts 3.12.0-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 3,288 kB
  • sloc: python: 11,445; makefile: 24
file content (33 lines) | stat: -rw-r--r-- 646 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
"""From issue #219."""

import pytest


@pytest.mark.parametrize(
    "cmd",
    [
        "foo --version 1.2.3",
        "foo --version=1.2.3",
    ],
)
def test_version_subapp_version_parameter(app, assert_parse_args, cmd):
    @app.command(version_flags=[])
    def foo(version: str):
        pass

    assert_parse_args(foo, cmd, version="1.2.3")


@pytest.mark.parametrize(
    "cmd",
    [
        "foo --help 1.2.3",
        "foo --help=1.2.3",
    ],
)
def test_version_subapp_help_parameter(app, assert_parse_args, cmd):
    @app.command(help_flags=[])
    def foo(help: str):
        pass

    assert_parse_args(foo, cmd, help="1.2.3")