def test_bad_input(self): with pytest.raises(ValueError): from_string_to_parse_size(17) with pytest.raises(ValueError): from_string_to_parse_size(None) with pytest.raises(ValueError): from_string_to_parse_size('') # bad conversion with pytest.raises(ValueError): from_string_to_parse_size('g1') # unknown size suffix with pytest.raises(ValueError): from_string_to_parse_size('1g')
def test_bad_input(self): with pytest.raises(ValueError): from_string_to_parse_size(17) with pytest.raises(ValueError): from_string_to_parse_size(None) with pytest.raises(ValueError): from_string_to_parse_size('') # bad conversion with pytest.raises(ValueError): from_string_to_parse_size('g1') # unknown size suffix with pytest.raises(ValueError): from_string_to_parse_size('1g')
def test_ok(self): assert from_string_to_parse_size("1") == 1 # WHY LOWER CASE? assert from_string_to_parse_size("1k") == 1024 assert from_string_to_parse_size("1M") == 1048576 assert from_string_to_parse_size("1G") == 1073741824
def test_ok(self): assert from_string_to_parse_size("1") == 1 # WHY LOWER CASE? assert from_string_to_parse_size("1k") == 1024 assert from_string_to_parse_size("1M") == 1048576 assert from_string_to_parse_size("1G") == 1073741824
def test_ok(self): eq_(from_string_to_parse_size("1"), 1) eq_(from_string_to_parse_size("1k"), 1024) # WHY LOWER CASE? eq_(from_string_to_parse_size("1M"), 1048576) eq_(from_string_to_parse_size("1G"), 1073741824)