revert 0-formatting to be compatible with previous behaviour

as we format differences (growing/shrinking) we want:
-N  # negative / shrinking
 0  # no change -> no +/- sign here!
+N  # positive / growing
This commit is contained in:
Thomas Waldmann 2020-07-06 19:45:24 +02:00
parent 831448684c
commit 87e3b699c0
2 changed files with 2 additions and 2 deletions

View File

@ -271,7 +271,7 @@ def parse_file_size(s):
def sizeof_fmt(num, suffix='B', units=None, power=None, sep='', precision=2, sign=False):
sign = '+' if sign else ''
sign = '+' if sign and num > 0 else ''
fmt = '{0:{1}.{2}f}{3}{4}{5}'
prec = 0
for unit in units[:-1]:

View File

@ -579,7 +579,7 @@ def test_file_size_precision():
def test_file_size_sign():
si_size_map = {
0: '+0 B',
0: '0 B',
1: '+1 B',
1234: '+1.23 kB',
-1: '-1 B',