def test_compare_two_dictionaries_where_values_are_arrays_four(): # The dictionaries are equal d1 = {0: np.array([1, 2, 3]), 1: np.array([4, 5, 6])} d2 = {0: np.array([1, 2, 3]), 1: np.array([4, 5, 6])} are_equal = compare_methods.compare_two_dictionaries_where_values_are_arrays(d1, d2) assert are_equal
def test_compare_two_dictionaries_where_values_are_arrays_one(): # Dictionaries have different lengths d1 = {0: np.array([1, 2, 3]), 1: np.array([4, 5, 6])} d2 = {0: np.array([1, 2, 3])} are_equal = compare_methods.compare_two_dictionaries_where_values_are_arrays(d1, d2) assert are_equal is False
def test_compare_two_dictionaries_where_values_are_arrays_three(): # The values are in different orders d1 = {0: np.array([1, 2, 3])} d2 = {1: np.array([1, 3, 2])} are_equal = compare_methods.compare_two_dictionaries_where_values_are_arrays(d1, d2) assert are_equal is False
def test_get_indices_leading_to_endpoints(): endpoints = np.array([7, 7, 7, 5, 5, 5, 7, 7, 7, 22, 5, 5, 13, 13, 13, 22, 22, 23, 13, 13, 13, 22, 22, 23, 13, 13, 13, 28, 28, 29]) # unique_endpoints = np.array([5, 7, 13, 22, 23, 28, 29]) result_indices_to_endpoints = {5: np.array([3, 4, 5, 10, 11]), 7: np.array([0, 1, 2, 6, 7, 8]), 13: np.array([12, 13, 14, 18, 19, 20, 24, 25, 26]), 22: np.array([9, 15, 16, 21, 22]), 23: np.array([17, 23]), 28: np.array([27, 28]), 29: np.array([29])} indices_to_endpoints = trap_analysis.get_indices_leading_to_endpoints(endpoints) for minimum in indices_to_endpoints: indices_to_endpoints[minimum] = np.sort(indices_to_endpoints[minimum]) are_equal = compare_methods.compare_two_dictionaries_where_values_are_arrays(indices_to_endpoints, result_indices_to_endpoints) assert are_equal