File: test_3_cli.py

package info (click to toggle)
python-plumbum 1.9.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,300 kB
  • sloc: python: 10,016; makefile: 130; sh: 8
file content (27 lines) | stat: -rw-r--r-- 770 bytes parent folder | download
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
from __future__ import annotations

from plumbum import cli


class Main3Validator(cli.Application):
    def main(self, myint: int, myint2: int, *mylist: int):
        print(myint, myint2, mylist)


class TestProg3:
    def test_prog(self, capsys):
        _, rc = Main3Validator.run(["prog", "1", "2", "3", "4", "5"], exit=False)
        assert rc == 0
        assert "1 2 (3, 4, 5)" in capsys.readouterr()[0]


class Main4Validator(cli.Application):
    def main(self, myint: int, myint2: int, *mylist: int) -> None:
        print(myint, myint2, mylist)


class TestProg4:
    def test_prog(self, capsys):
        _, rc = Main4Validator.run(["prog", "1", "2", "3", "4", "5"], exit=False)
        assert rc == 0
        assert "1 2 (3, 4, 5)" in capsys.readouterr()[0]