Katya Y117 47 154 - Vladmodels
try: width = int(width_str) height = int(height_str) except ValueError as exc: raise ValueError( f"Width and height must be integer numbers; got 'width_str' and 'height_str'" ) from exc
def test_basic_parsing(): raw = "vladmodels katya y117 47 154" model = parse_vladmodels_spec(raw) assert model == VladModel( brand="vladmodels", name="katya", code="y117", width_mm=47, height_mm=154, ) assert model.area_mm2 == 47 * 154 vladmodels katya y117 47 154
@property def area_mm2(self) -> int: """Surface area in square millimetres (width × height).""" return self.width_mm * self.height_mm try: width = int(width_str) height = int(height_str) except
Expected format (case‑insensitive): "<brand> <name> <code> <width> <height>" Example: "vladmodels katya y117 47 154" height_str = tokens return VladModel( brand=brand
brand, name, code, width_str, height_str = tokens
return VladModel( brand=brand, name=name, code=code, width_mm=width, height_mm=height, )
Raises ------ ValueError If the string does not contain exactly 5 tokens, or if numeric conversion fails, or if the brand token is not ``vladmodels``. """ tokens = _split_and_clean(spec.lower())