def test_bridge_2212_in_2200_2220(self): expect = 2203 actual = bf.find_closest_bridge(BRIDGE_FORMATTED_BACK_UP[2200:2220], 2212) self.assertEqual( expect, actual, "The bridge 2221 is the closest one to 2212 between 2200 and 2300")
def test_bridge3(self): expect = 2 actual = bf.find_closest_bridge(BRIDGE_FORMATTED_BACK_UP[1:3], 3) self.assertEqual( expect, actual, "There are only two bridges in the list no matted how far away you have to return the id beside 3" )
def test_last_fifty(self): expect = fb.last_fifty_closest actual = [] for i in range(2732, 2782): actual.append( bf.find_closest_bridge(BRIDGE_FORMATTED_BACK_UP[2731:], i)) self.assertListEqual(expect, actual, "This test the list of your last fifty bridges")
def test_first_fifty(self): expect = fb.first_fifty_closest actual = [] for i in range(1, 51): actual.append( bf.find_closest_bridge(BRIDGE_FORMATTED_BACK_UP[0:50], i)) self.assertListEqual(expect, actual, "This test the list of your first fifty bridges")
def test_bridge_random_two_id(self): expect = 917 first_list = bf.get_bridge(BRIDGE_FORMATTED_BACK_UP, 917) second_list = bf.get_bridge(BRIDGE_FORMATTED_BACK_UP, 3) test_list = [] test_list.append(first_list) test_list.append(second_list) actual = bf.find_closest_bridge(test_list, 3) self.assertEqual( expect, actual, "There are randomly two list in the list no matted how far away you have to return the id beside 3" )
lst[9] = lst[9][:] lst[12] = lst[12][:] result = bf.get_distance_between(sample[0], sample[1]) assert isinstance(result, float), \ '''bridge_functions.get_distance_between should return a float''' our_print(' check complete') #Type and simple check bridge_functions.find_closest_bridge our_print('Checking find_closest_bridge...') sample = [inner[:] for inner in sample_bridges] for lst in sample: lst[9] = lst[9][:] lst[12] = lst[12][:] result = bf.find_closest_bridge(sample, 1) assert isinstance(result, int), \ '''bridge_functions.find_closest_bridge should return an int''' our_print(' check complete') #Type and simple check bridge_functions.find_bridges_in_radius our_print('Checking find_bridges_in_radius...') sample = [inner[:] for inner in sample_bridges] for lst in sample: lst[9] = lst[9][:] lst[12] = lst[12][:] result = bf.find_bridges_in_radius(sample, 43.0, -80.0, 1000) assert isinstance(result, list), \ '''bridge_functions.find_bridges_in_radius should return a list''' for item in result:
def test_all_bridge_2212(self): expect = 2192 actual = bf.find_closest_bridge(BRIDGE_FORMATTED_BACK_UP, 2212) self.assertEqual( expect, actual, "The bridge 2191 is the closest one to 2212 across all bridges")
def test_bridge_10(self): expect = 1 actual = bf.find_closest_bridge(BRIDGE_FORMATTED_BACK_UP, 10) self.assertEqual(expect, actual, "The brige 1 is the closest bridge to bridge 10")
def test_bridge_9(self): expect = 7 actual = bf.find_closest_bridge(BRIDGE_FORMATTED_BACK_UP, 9) self.assertEqual(expect, actual, "The brige 7 is the closest bridge to bridge 9")
def test_bridge_7(self): expect = 8 actual = bf.find_closest_bridge(BRIDGE_FORMATTED_BACK_UP, 7) self.assertEqual(expect, actual, "The brige 8 is the closest bridge to bridge 7")