1 | import pytest |
||
0 ignored issues
–
show
introduced
by
![]() |
|||
2 | from typer.testing import CliRunner |
||
0 ignored issues
–
show
|
|||
3 | |||
4 | from mandos.cli import Commands, What, cli |
||
0 ignored issues
–
show
|
|||
5 | |||
6 | from . import get_test_resource |
||
7 | |||
8 | |||
9 | class TestCli: |
||
0 ignored issues
–
show
|
|||
10 | def test_help(self): |
||
0 ignored issues
–
show
This method could be written as a function/class method.
If a method does not access any attributes of the class, it could also be implemented as a function or static method. This can help improve readability. For example class Foo:
def some_method(self, x, y):
return x + y;
could be written as class Foo:
@classmethod
def some_method(cls, x, y):
return x + y;
![]() |
|||
11 | runner = CliRunner() |
||
12 | result = runner.invoke(cli, ["--help"]) |
||
13 | assert result.exit_code == 0 |
||
14 | assert "Usage" in result.stdout |
||
15 | |||
16 | def test_search(self): |
||
0 ignored issues
–
show
This method could be written as a function/class method.
If a method does not access any attributes of the class, it could also be implemented as a function or static method. This can help improve readability. For example class Foo:
def some_method(self, x, y):
return x + y;
could be written as class Foo:
@classmethod
def some_method(cls, x, y):
return x + y;
![]() |
|||
17 | runner = CliRunner() |
||
18 | path = get_test_resource("inchis.txt") |
||
19 | result = runner.invoke(cli, ["search", "atc", str(path)]) |
||
20 | if result.exception is not None: |
||
21 | raise result.exception |
||
22 | assert result.stdout == "" |
||
23 | |||
24 | |||
25 | if __name__ == "__main__": |
||
26 | pytest.main() |
||
27 |