def test_segmented_field_to_center_values_01(): r'''Truncated to avoid decimal problems between different machine architectures. ''' segmented_field = [ (-24, -22, -14), (-12.5, -12, -10, -7, -4.5, -2, 3), (3.5, 5.5, 7.5, 8.5, 13, 17), (27, 37), ] center_values = to_center_values(segmented_field) # center_values == [-20, -6.4, 9.2, 32] truncated_center_values = [int(_) for _ in center_values] assert truncated_center_values == [-20, -6, 9, 32]
def test_segmented_field_to_center_values_02(): r'''Truncated to avoid decimal problems between different machine architectures. ''' segmented_field = [ (-10, -9, -5, -2), (-1, 0.5, 1), (3, 5, 11, 13, 15.5, 17.5, 19, 20), (26, 32, 33, 34), (41, 45), ] center_values = to_center_values(segmented_field) # center_values == [-6.5, 0.2, 13, 31.3, 43] truncated_center_values = [int(_) for _ in center_values] assert truncated_center_values == [-6, 0, 13, 31, 43]