tests.test_cli.describe_cli()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 13
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 10
nop 0
dl 0
loc 13
rs 9.9
c 0
b 0
f 0
1
"""Sample integration test module using pytest-describe and expecter."""
2
# pylint: disable=redefined-outer-name,unused-variable,expression-not-assigned
3
4
import pytest
5
from click.testing import CliRunner
6
from expecter import expect
7
8
from demo.cli import main
9
10
11
@pytest.fixture
12
def runner():
13
    return CliRunner()
14
15
16
def describe_cli():
17
    def describe_conversion():
18
        def when_integer(runner):
19
            result = runner.invoke(main, ['42'])
20
21
            expect(result.exit_code) == 0
22
            expect(result.output) == "12.80165\n"
23
24
        def when_invalid(runner):
25
            result = runner.invoke(main, ['foobar'])
26
27
            expect(result.exit_code) == 0
28
            expect(result.output) == ""
29