compose-viz/tests/test_extends.py
2022-05-27 14:17:04 +08:00

28 lines
757 B
Python

import pytest
from compose_viz.models.extends import Extends
def test_extend_init_normal() -> None:
try:
e = Extends(service_name="frontend", from_file="tests/ymls/others/empty.yaml")
assert e.service_name == "frontend"
assert e.from_file == "tests/ymls/others/empty.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/ymls/others/empty.yaml") # type: ignore