@@ -9,25 +9,25 @@ class TestParseGlobalSegmentSize(unittest.TestCase):
99 def test_int_input (self ):
1010 self .assertEqual (_parse_global_segment_size (1024 ), 1024 )
1111 self .assertEqual (_parse_global_segment_size (0 ), 0 )
12-
12+
1313 def test_gb_unit (self ):
1414 self .assertEqual (_parse_global_segment_size ("2GB" ), 2 * 1024 ** 3 )
1515 self .assertEqual (_parse_global_segment_size ("1.5GB" ),
1616 int (1.5 * 1024 ** 3 ))
1717 self .assertEqual (_parse_global_segment_size (" 2 GB " ), 2 * 1024 ** 3 )
18-
18+
1919 def test_gb_unit_edge_cases (self ):
2020 with self .assertRaises (ValueError ):
2121 _parse_global_segment_size ("GB" )
2222 with self .assertRaises (ValueError ):
2323 _parse_global_segment_size ("abcGB" )
24-
24+
2525 def test_mb_unit (self ):
2626 self .assertEqual (_parse_global_segment_size ("512MB" ), 512 * 1024 ** 2 )
2727 self .assertEqual (_parse_global_segment_size ("0.5MB" ),
2828 int (0.5 * 1024 ** 2 ))
2929 self .assertEqual (_parse_global_segment_size ("1024MB" ), 1024 * 1024 ** 2 )
30-
30+
3131 def test_kb_unit (self ):
3232 self .assertEqual (_parse_global_segment_size ("256KB" ), 256 * 1024 )
3333 self .assertEqual (_parse_global_segment_size ("1.25KB" ),
@@ -36,24 +36,24 @@ def test_kb_unit(self):
3636 def test_b_unit (self ):
3737 self .assertEqual (_parse_global_segment_size ("4096B" ), 4096 )
3838 self .assertEqual (_parse_global_segment_size ("1024b" ), 1024 )
39-
39+
4040 def test_no_unit (self ):
4141 self .assertEqual (_parse_global_segment_size ("2048" ), 2048 )
4242 self .assertEqual (_parse_global_segment_size ("0" ), 0 )
4343
4444 def test_non_string_non_int_input (self ):
4545 self .assertEqual (_parse_global_segment_size (2048.0 ), 2048 )
4646 self .assertEqual (_parse_global_segment_size (True ), 1 )
47-
47+
4848 with self .assertRaises (TypeError ):
4949 _parse_global_segment_size (None )
50-
50+
5151 with self .assertRaises (TypeError ):
5252 _parse_global_segment_size ({"size" : 1024 })
5353
5454
5555class TestConvertToBytes (unittest .TestCase ):
56-
56+
5757 def test_valid_conversion (self ):
5858 self .assertEqual (_convert_to_bytes ("10" , 1 , "10" ), 10 )
5959 self .assertEqual (_convert_to_bytes ("1.5" , 1024 , "1.5KB" ),
@@ -63,7 +63,6 @@ def test_valid_conversion(self):
6363 def test_invalid_numbers (self ):
6464 with self .assertRaises (ValueError ):
6565 _convert_to_bytes ("abc" , 1 , "abc" )
66-
66+
6767 with self .assertRaises (ValueError ):
6868 _convert_to_bytes ("1.2.3" , 1024 , "1.2.3KB" )
69-
0 commit comments