def number_output( n: Union[float, int, None]) -> Optional[Union[float, int, None]]: """Format numbers for data series outputs""" if n is None: return None if n == 0: return 0 return sigfig_compact(n)
def test_sigfig_compact(number: float, number_expected: float) -> None: number = sigfig_compact(number, 4) assert number == number_expected