compose-viz/tests/test_extends.py
2022-05-21 17:25:56 +08:00

28 lines
726 B
Python

import pytest
from compose_viz.extends import Extends
def test_extend_init_normal() -> None:
try:
e = Extends(service_name="frontend", from_file="tests/in/000001.yaml")
assert e.service_name == "frontend"
assert e.from_file == "tests/in/000001.yaml"
except Exception as e:
assert False, e
def test_extend_init_without_from_file() -> None:
try:
e = Extends(service_name="frontend")
assert e.service_name == "frontend"
assert e.from_file is None
except Exception as e:
assert False, e
def test_extend_init_without_service_name() -> None:
with pytest.raises(TypeError):
Extends(from_file="tests/in/000001.yaml") # type: ignore