diff --git a/mitmproxy/utils/human.py b/mitmproxy/utils/human.py index 951feef4a..b301ba1b1 100644 --- a/mitmproxy/utils/human.py +++ b/mitmproxy/utils/human.py @@ -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 diff --git a/test/mitmproxy/utils/test_human.py b/test/mitmproxy/utils/test_human.py index 6f8bf732f..9317388d4 100644 --- a/test/mitmproxy/utils/test_human.py +++ b/test/mitmproxy/utils/test_human.py @@ -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"