コード例 #1
0
ファイル: test_tools.py プロジェクト: Sedl/servus
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
ファイル: test_tools.py プロジェクト: Sedl/servus
def test_human2bytes_exc2():
    tools.human2bytes('asdf')
コード例 #3
0
ファイル: xmlhelper.py プロジェクト: Sedl/servus
 def validate(self, text):
     human2bytes(text)
コード例 #4
0
ファイル: test_tools.py プロジェクト: Sedl/servus
def test_human2bytes_exc1():
    tools.human2bytes('')
コード例 #5
0
ファイル: xmlhelper.py プロジェクト: Sedl/servus
 def from_xml(self, text):
     return human2bytes(text)