def test_number_bytes_format(): x = [1000, 1000000, 4e5] labels = number_bytes_format(symbol='MiB')(x) assert labels == ['0 MiB', '1 MiB', '0 MiB'] labels = number_bytes_format(symbol='MiB', fmt='{:.2f} ')(x) assert labels == ['0.00 MiB', '0.95 MiB', '0.38 MiB'] with pytest.raises(ValueError): number_bytes_format(symbol='Bad')(x)
def test_empty_breaks(): x = [] assert custom_format()(x) == [] assert comma_format()(x) == [] assert currency_format()(x) == [] assert percent_format()(x) == [] assert scientific_format()(x) == [] assert date_format()(x) == [] assert mpl_format()(x) == [] assert log_format()(x) == [] assert timedelta_format()(x) == [] assert pvalue_format()(x) == [] assert ordinal_format()(x) == [] assert number_bytes_format()(x) == []