Пример #1
0
def test_human2bytes():
    assert tools.human2bytes('1TB') == 10**12
    assert tools.human2bytes('1GB') == 10**9
    assert tools.human2bytes('1.5GB') == 10**9*1.5
    assert tools.human2bytes('1MB') == 10**6
    assert tools.human2bytes('1KB') == 10**3
    assert tools.human2bytes('128') == 128
    assert tools.human2bytes('0') == 0
    assert tools.human2bytes('1TiB') == 1024**4
    assert tools.human2bytes('1GiB') == 1024**3
    assert tools.human2bytes('1MiB') == 1024**2
    assert tools.human2bytes('1kiB') == 1024
Пример #2
0
def test_human2bytes_exc2():
    tools.human2bytes('asdf')
Пример #3
0
 def validate(self, text):
     human2bytes(text)
Пример #4
0
def test_human2bytes_exc1():
    tools.human2bytes('')
Пример #5
0
 def from_xml(self, text):
     return human2bytes(text)