Length.py
Summary
- Lines:
5 of 8 covered (62.5%)
- Branches:
3 of 6 taken (50.0%), 1 lines partially
- Coverage:
57.1%
- Directory:
- Missed lines:
14-17
Source
myPackage/Units/Length.pycoveredpartialuncoveredexcludednot executable
1"""Conversion of lengths to meters."""
2
3
4def ToMeters(value: float, unit: str) -> float:
5 """
6 Convert a length to meters.
7
8 The doc-string spans lines, as a lexer has to see it whole.
9 """
10 if unit == "m":
11 return value
12 elif unit == "cm":
13 return value / 100
14 elif unit == "mm":
15 return value / 1000
16
17 raise ValueError(f"Unknown unit '{unit}'.")