Пример #1
0
def test_bytes2human():
    assert tools.bytes2human(10**9*10) == '10GB'
    assert tools.bytes2human(10**12*10) == '10TB'
    assert tools.bytes2human(1024**3) == '1GiB'
    assert tools.bytes2human(1024**3*10) == '10GiB'
    assert tools.bytes2human(1) == '1'
Пример #2
0
 def to_xml(self, obj):
     return bytes2human(obj)