|
74 | 74 | ([3000, False, True, "%.3f"], "2.930K"), |
75 | 75 | ([3000000000, False, True, "%.0f"], "3G"), |
76 | 76 | ([10**26 * 30, True, False, "%.3f"], "2.423 RiB"), |
77 | | - ([1.123456789], "1 Bytes"), |
| 77 | + ([1.123456789], "1.1 Bytes"), |
78 | 78 | ([1.123456789 * 10**3], "1.1 kB"), |
79 | 79 | ([1.123456789 * 10**6], "1.1 MB"), |
80 | | - ([1.123456789, False, True], "1B"), |
| 80 | + ([1.123456789, False, True], "1.1B"), |
81 | 81 | ([1.123456789 * 10**3, False, True], "1.1K"), |
82 | 82 | ([1.123456789 * 10**6, False, True], "1.1M"), |
83 | 83 | # Rounding must not leave the mantissa at the base while a larger suffix |
|
89 | 89 | ([1024**2 - 1, True], "1.0 MiB"), |
90 | 90 | ([1024**3 - 1, True], "1.0 GiB"), |
91 | 91 | ([1024**2 - 1, False, True], "1.0M"), |
| 92 | + ([1.5], "1.5 Bytes"), |
| 93 | + ([1.9], "1.9 Bytes"), |
| 94 | + ([0.5], "0.5 Bytes"), |
| 95 | + (["1.5"], "1.5 Bytes"), |
| 96 | + ([999.5], "999.5 Bytes"), |
| 97 | + ([999.94], "999.9 Bytes"), |
| 98 | + ([1.5, True], "1.5 Bytes"), |
| 99 | + ([1.123456789, True], "1.1 Bytes"), |
| 100 | + ([1023.5, True], "1023.5 Bytes"), |
| 101 | + ([1.5, False, True], "1.5B"), |
| 102 | + ([1023.5, False, True], "1023.5B"), |
| 103 | + ([1.25, False, False, "%.2f"], "1.25 Bytes"), |
| 104 | + ([1.5, False, True, "%.3f"], "1.500B"), |
| 105 | + ([2.04], "2.0 Bytes"), |
| 106 | + ([1.04], "1.0 Bytes"), |
| 107 | + ([0.96], "1.0 Bytes"), |
| 108 | + ([2.0], "2 Bytes"), |
| 109 | + ([999], "999 Bytes"), |
| 110 | + ([999.0], "999 Bytes"), |
| 111 | + ([1023, True], "1023 Bytes"), |
| 112 | + ([1023, False, True], "1023B"), |
| 113 | + ([300, False, False, "%.3f"], "300 Bytes"), |
| 114 | + ([300, False, True, "%.3f"], "300B"), |
| 115 | + ([1.0, False, False, "%.3f"], "1 Byte"), |
92 | 116 | ], |
93 | 117 | ) |
94 | 118 | def test_naturalsize(test_args: list[int] | list[int | bool], expected: str) -> None: |
|
0 commit comments