class CourseDetails: def __init__(self): self.filename = 'RORC De Guingand Bowl Race 2017' self.course = Course(self.filename) self.course.add_start_time_UTC(datetime.datetime(2017, 5, 13, 8, 20)) #Cowes RYS Startline self.course.add_startline(50.767, -1.301, 50.787, -1.309, 'West') self.course.add_waypoint(1, 'name', 'Cowes No.2 Buoy') self.course.add_waypoint(1, 'latitude', 50.768) self.course.add_waypoint(1, 'longitude', -1.298) self.course.add_waypoint(2, 'name', 'No Mans Land Fort') self.course.add_waypoint(2, 'latitude', 50.74) self.course.add_waypoint(2, 'longitude', -1.094) self.course.add_waypoint(3, 'name', 'Bembridge Ledge Buoy') self.course.add_waypoint(3, 'latitude', 50.686) self.course.add_waypoint(3, 'longitude', -1.047) self.course.add_waypoint(4, 'name', 'West Princessa Buoy') self.course.add_waypoint(4, 'latitude', 50.669) self.course.add_waypoint(4, 'longitude', -1.059) self.course.add_waypoint(5, 'name', 'St Catherines Light') self.course.add_waypoint(5, 'latitude', 50.568) self.course.add_waypoint(5, 'longitude', -1.30) self.course.add_waypoint(6, 'name', 'Needles Fairway') self.course.add_waypoint(6, 'latitude', 50.637) self.course.add_waypoint(6, 'longitude', -1.650) self.course.add_waypoint(7, 'name', 'North Head Buoy') self.course.add_waypoint(7, 'latitude', 50.7115) self.course.add_waypoint(7, 'longitude', -1.592) self.course.add_waypoint(8, 'name', 'East Shambles Buoy') self.course.add_waypoint(8, 'latitude', 50.521) self.course.add_waypoint(8, 'longitude', -2.335) self.course.add_waypoint(9, 'name', 'St Catherines Light') self.course.add_waypoint(9, 'latitude', 50.568) self.course.add_waypoint(9, 'longitude', -1.30) self.course.add_waypoint(10, 'name', 'New Ground Buoy') self.course.add_waypoint(10, 'latitude', 50.697) self.course.add_waypoint(10, 'longitude', -0.975) self.course.add_waypoint(11, 'name', 'No Mans Land Fort') self.course.add_waypoint(11, 'latitude', 50.74) self.course.add_waypoint(11, 'longitude', -1.094) self.course.add_waypoint(12, 'name', 'FINISH Mother Bank Buoy') self.course.add_waypoint(12, 'latitude', 50.758) self.course.add_waypoint(12, 'longitude', -1.186)
class CourseDetails: def __init__(self): self.filename = 'RORC De Guingand Bowl Race 2017' self.course = Course(self.filename) self.course.add_start_time_UTC(datetime.datetime(2017, 5, 13, 8, 20)) #Cowes RYS Startline self.course.add_startline(50.767, -1.301, 50.787, -1.309, 'West') self.course.add_waypoint(1, 'name', 'Snowden Buoy') self.course.add_waypoint(1, 'latitude', 50.77) self.course.add_waypoint(1, 'longitude', -1.2958) self.course.add_waypoint(2, 'name', 'No Mans Land Fort') self.course.add_waypoint(2, 'latitude', 50.7406) self.course.add_waypoint(2, 'longitude', -1.0933) self.course.add_waypoint(3, 'name', 'Owers Buoy') self.course.add_waypoint(3, 'latitude', 50.6432) self.course.add_waypoint(3, 'longitude', -0.6848) self.course.add_waypoint(4, 'name', 'St Catherines Point') self.course.add_waypoint(4, 'latitude', 50.5756) self.course.add_waypoint(4, 'longitude', -1.2978) self.course.add_waypoint(5, 'name', 'ODAS Buoy (Southern)') self.course.add_waypoint(5, 'latitude', 50.4335) self.course.add_waypoint(5, 'longitude', -1.81) self.course.add_waypoint(6, 'name', 'Poole Bar Buoy (No. 1)') self.course.add_waypoint(6, 'latitude', 50.6548) self.course.add_waypoint(6, 'longitude', -1.919) self.course.add_waypoint(7, 'name', 'SW Shingles Buoy') self.course.add_waypoint(7, 'latitude', 50.6548) self.course.add_waypoint(7, 'longitude', -1.6253) self.course.add_waypoint(8, 'name', 'ODAS Buoy (Northern)') self.course.add_waypoint(8, 'latitude', 50.5532) self.course.add_waypoint(8, 'longitude', -1.7195) self.course.add_waypoint(9, 'name', 'Poole Bar Buoy (No. 1)') self.course.add_waypoint(9, 'latitude', 50.6548) self.course.add_waypoint(9, 'longitude', -1.919) self.course.add_waypoint(10, 'name', 'North Head Buoy') self.course.add_waypoint(10, 'latitude', 50.7115) self.course.add_waypoint(10, 'longitude', -1.592) self.course.add_waypoint(11, 'name', 'FINISH - Lymington Bank Buoy') self.course.add_waypoint(11, 'latitude', 50.7183) self.course.add_waypoint(11, 'longitude', -1.5142)
def test_that_a_startline_can_be_added_to_course(self): course = Course() expected = { 'lat_pin_1': 0.00, 'lon_pin_1': 0.00, 'lat_pin_2': 0.00, 'lon_pin_2': 0.00, 'start_from': 'West' } course.add_startline(0.00, 0.00, 0.00, 0.00, 'West') actual = course.startline self.assertDictEqual(expected, actual)
def test_that_startline_gets_pickled(self): course = Course(self.filename) expected = { 'lat_pin_1': -1.23, 'lon_pin_1': 9.87, 'lat_pin_2': 9.87, 'lon_pin_2': 9.87, 'start_from': 'North' } course.add_startline(-1.23, 9.87, 9.87, 9.87, 'North') course.pickle_startline() course = None course = Course(self.filename) actual = course.startline self.assertDictEqual(expected, actual)