mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-22 15:37:45 +00:00
Improve rendering of size column
This commit is contained in:
parent
88374e958b
commit
4266c4852c
@ -20,7 +20,7 @@ def pretty_size(size):
|
||||
if bottom[1] <= size < top[1]:
|
||||
suf = bottom[0]
|
||||
lim = bottom[1]
|
||||
x = round(size / lim, 2)
|
||||
x = round(size / lim)
|
||||
if x == int(x):
|
||||
x = int(x)
|
||||
return str(x) + suf
|
||||
|
@ -29,7 +29,7 @@ def test_pretty_size():
|
||||
assert human.pretty_size(0) == "0b"
|
||||
assert human.pretty_size(100) == "100b"
|
||||
assert human.pretty_size(1024) == "1k"
|
||||
assert human.pretty_size(1024 + (1024 / 2.0)) == "1.5k"
|
||||
assert human.pretty_size(1024 + (1024 / 2.0)) == "2k"
|
||||
assert human.pretty_size(1024 * 1024) == "1m"
|
||||
assert human.pretty_size(10 * 1024 * 1024) == "10m"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user