Exemple #1
0
def test_machinesize():
    assert_equal(1.0, machinesize(1))
    for key, value in {
            'Byte': 0,
            'Bytes': 0,
            'kB': 1,
            'MB': 2,
            'GB': 3,
            'TB': 4,
            'PB': 5
    }.items():
        assert_equal(1.0 * (1000**value), machinesize('1 ' + key))
    assert_raises(ValueError, machinesize, 't byte')
Exemple #2
0
def test_machinesize():
    assert_equal(1.0, machinesize(1))
    for key, value in {'Byte': 0, 'Bytes': 0, 'kB': 1, 'MB': 2, 'GB': 3, 'TB': 4, 'PB': 5}.items():
        assert_equal(1.0*(1000**value), machinesize('1 ' + key))
    assert_raises(ValueError, machinesize, 't byte')
    assert_equal(0, machinesize(UNKNOWN_SIZE))