2022-05-16 18:57:14 +02:00
|
|
|
import os
|
2022-05-18 16:47:54 +02:00
|
|
|
import pytest
|
2022-05-16 18:57:14 +02:00
|
|
|
|
2022-05-07 18:42:14 +02:00
|
|
|
from typer.testing import CliRunner
|
|
|
|
from compose_viz import cli
|
|
|
|
|
|
|
|
|
|
|
|
runner = CliRunner()
|
|
|
|
|
2022-05-18 16:47:54 +02:00
|
|
|
@pytest.mark.parametrize("file_number", [
|
|
|
|
"000001",
|
|
|
|
"000010",
|
|
|
|
"000011",
|
|
|
|
"000100",
|
|
|
|
"000101",
|
|
|
|
"000110",
|
|
|
|
"000111",
|
|
|
|
"001000",
|
|
|
|
"001001",
|
|
|
|
"001010",
|
|
|
|
"001011",
|
|
|
|
"001100",
|
|
|
|
"001101",
|
|
|
|
"001110",
|
|
|
|
"001111",
|
|
|
|
"010000",
|
|
|
|
"010001",
|
|
|
|
"010010",
|
|
|
|
"010011",
|
|
|
|
"010100",
|
|
|
|
"010101",
|
|
|
|
"010110",
|
|
|
|
"010111",
|
|
|
|
"011000",
|
|
|
|
"011001",
|
|
|
|
"011010",
|
|
|
|
"011011",
|
|
|
|
"011100",
|
|
|
|
"011101",
|
|
|
|
"011110",
|
|
|
|
"011111",
|
|
|
|
"100000",
|
|
|
|
"100001",
|
|
|
|
"100010",
|
|
|
|
"100011",
|
|
|
|
"100100",
|
|
|
|
"100101",
|
|
|
|
"100110",
|
|
|
|
"100111",
|
|
|
|
"101000",
|
|
|
|
"101001",
|
|
|
|
"101010",
|
|
|
|
"101011",
|
|
|
|
"101100",
|
|
|
|
"101101",
|
|
|
|
"101110",
|
|
|
|
"101111",
|
|
|
|
"110000",
|
|
|
|
"110001",
|
|
|
|
"110010",
|
|
|
|
"110011",
|
|
|
|
"110100",
|
|
|
|
"110101",
|
|
|
|
"110110",
|
|
|
|
"110111",
|
|
|
|
"111000",
|
|
|
|
"111001",
|
|
|
|
"111010",
|
|
|
|
"111011",
|
|
|
|
"111100",
|
|
|
|
"111101",
|
|
|
|
"111110",
|
|
|
|
"111111",
|
|
|
|
])
|
|
|
|
def test_cli(file_number: str):
|
|
|
|
input_path = f"tests/in/{file_number}.yaml"
|
|
|
|
output_path = f"{file_number}.png"
|
|
|
|
result = runner.invoke(cli.app, ["-o", output_path, input_path])
|
2022-05-07 18:42:14 +02:00
|
|
|
|
|
|
|
assert result.exit_code == 0
|
|
|
|
assert f"Successfully parsed {input_path}\n" in result.stdout
|
2022-05-18 16:47:54 +02:00
|
|
|
assert os.path.exists(output_path)
|
|
|
|
|
|
|
|
os.remove(output_path)
|