tests.test_cli.TestCli.test_search()   A
last analyzed

Complexity

Conditions 2

Size

Total Lines 7
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 7
nop 1
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
import pytest
0 ignored issues
show
introduced by
Missing module docstring
Loading history...
introduced by
Unable to import 'pytest'
Loading history...
2
from typer.testing import CliRunner
0 ignored issues
show
introduced by
Unable to import 'typer.testing'
Loading history...
3
4
from mandos.cli import Commands, What, cli
0 ignored issues
show
Unused Code introduced by
Unused Commands imported from mandos.cli
Loading history...
Unused Code introduced by
Unused What imported from mandos.cli
Loading history...
5
6
from . import get_test_resource
7
8
9
class TestCli:
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
10
    def test_help(self):
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
Coding Style introduced by
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;
Loading history...
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
introduced by
Missing function or method docstring
Loading history...
Coding Style introduced by
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;
Loading history...
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