|
11 | 11 | make_proxy_url, |
12 | 12 | parse_memory, |
13 | 13 | pretty_date, |
| 14 | + sizeof_fmt, |
14 | 15 | split_chunks, |
15 | 16 | ) |
16 | 17 |
|
@@ -211,3 +212,26 @@ def test_concat_url_path(a: str, b: str, result: str) -> None: |
211 | 212 | ) |
212 | 213 | def test_make_proxy_url(server_url, proxy_url, expected_url): |
213 | 214 | assert make_proxy_url(server_url, proxy_url) == expected_url |
| 215 | + |
| 216 | + |
| 217 | +class TestSizeofFmt: |
| 218 | + @pytest.mark.parametrize( |
| 219 | + ("num", "suffix", "expected"), |
| 220 | + [ |
| 221 | + (0, "B", "0.0B"), |
| 222 | + (1023, "B", "1023.0B"), |
| 223 | + (1024, "B", "1.0KiB"), |
| 224 | + (1536, "B", "1.5KiB"), |
| 225 | + (1048576, "B", "1.0MiB"), |
| 226 | + (1073741824, "B", "1.0GiB"), |
| 227 | + (1099511627776, "B", "1.0TiB"), |
| 228 | + (1125899906842624, "B", "1.0PiB"), |
| 229 | + (1152921504606846976, "B", "1.0EiB"), |
| 230 | + (1180591620717411303424, "B", "1.0ZiB"), |
| 231 | + (1208925819614629174706176, "B", "1.0YiB"), |
| 232 | + (2000, "", "2.0Ki"), |
| 233 | + (3000000, "Hz", "2.9MiHz"), |
| 234 | + ], |
| 235 | + ) |
| 236 | + def test_sizeof_fmt(self, num: int, suffix: str, expected: str) -> None: |
| 237 | + assert sizeof_fmt(num, suffix) == expected |
0 commit comments