Coverage for tests/_utils.py: 100%
21 statements
« prev ^ index » next coverage.py v6.5.0, created at 2023-02-09 12:09 +0100
« prev ^ index » next coverage.py v6.5.0, created at 2023-02-09 12:09 +0100
1from __future__ import annotations
3from typing import NamedTuple
4from typing import Optional
6from pydantic import ValidationError
8from harbor_cli.output.table import RENDER_FUNCTIONS
11class Parameter(NamedTuple):
12 param: str
13 value: Optional[str] = None
14 ok: bool = True
16 @property
17 def as_arg(self) -> list[str]:
18 if self.value is None:
19 return [self.param]
20 return [self.param, str(self.value)]
23compact_renderables = []
24for model in RENDER_FUNCTIONS.keys():
25 try:
26 obj = model()
27 except ValidationError:
28 continue
29 compact_renderables.append(model)