def runway_width(): """ Find out and display the width of the runways at Seatac airport. Args: None Returns: Displays the width of each of the runways at Seatac airport. The display goes to stdout. """ runway_obj = runways() airport_id = 'KSEA' result = runway_obj.runway_data_from_csv_file(airport_id) runway_width_dict = {} print('*' * 80) print('Runway widths', airport_id) print('Runway name', ' ' * 10, 'Runway width') # returned runway names are like 'runway_width_runway' for key in result: if '_width_' in key: # returned runway names are like 'runway_width_runway' name = key.split('_') runway_width_dict[str(name[2])] = result[key] width = runway_width_dict[str(name[2])] runway_name = str(name[2]) print('{0}{1:>30}'.format(runway_name, width)) print('*' * 80)
def runway_lighted(): """ Find out and display if the runway(s) of Seatac airport are lighted at night. Args: None Returns: Displays if the runway(s) of Seatac airport are lighted at night. The display goes to stdout. """ runway_obj = runways() airport_id = 'KSEA' runway_lit_dict = {} result = runway_obj.runway_data_from_csv_file(airport_id) for key in result: if '_lit_' in key: # returned runway names are like 'runway_lit_runway' name = key.split('_') runway_lit_dict[str(name[3])] = result[key] print('*' * 80) print('Runway lights', airport_id) print('Runway name', ' ' * 10, 'Runway lighted') for keys in runway_lit_dict: if runway_lit_dict[keys] == '1': flag = 'yes' else: flag = 'no' print('{0}{1:>30}'.format(keys, flag)) print('*' * 80)
def runway_status(): """ Find out and display if the runway(s) of Seatac airport are open or closed to landing. Args: None Returns: Displays if the runway(s) of Seatac airport are open or closed to landing. The display goes to stdout. """ runway_obj = runways() airport_id = 'KSEA' result = runway_obj.runway_data_from_csv_file(airport_id, status=True) print('*' * 80) print('Runway status', airport_id) print('Runway name', ' ' * 10, 'Runway status') # returned runway names are like 'runway_closed_runway' for key in result: name = key.split('_') if result[key] == '1': flag = 'closed' else: flag = 'open' print('{0}{1:>30}'.format(name[2], flag)) print('*' * 80)
def land_737(): """ Find out if a 737 can land at Seatac airport. runways. Args: None Returns: Displays whether or not a 737 can land at Seatac on stdout. """ # takes 6791 ft of runway to land a 737 landing_737 = 6791.0 landing_flag = False runway_obj = runways() airport_id = 'KSEA' result = runway_obj.runway_data_from_csv_file(airport_id, length=True) print('*' * 80) print('Runway lengths', airport_id) print('Runway name', ' ' * 10, 'Runway length', ' ' * 10, '737?') # returned runway names are like 'runway_elevation_runway' for runway_length in result: length = runway_length.split('_') if float(result[runway_length]) / landing_737 > 1.0: landing_flag = True print('{0}{1:>30}{2:>17}'.format(length[2], result[runway_length], landing_flag)) landing_flag = False print('*' * 80)
def test_runway_data_from_csv_file_length_status_elevation_true(): runway_obj = runways() result = runway_obj.runway_data_from_csv_file("KSEA", length=True, status=True, elevation=True) assert len(result) == 12 assert type(result) == dict
def runway_length(): """ Display the runway length(s) of Seatac airport. Args: None Returns: Displays the runway lenght(s) of Seatac airport on stdout. """ runway_obj = runways() airport_id = 'KSEA' result = runway_obj.runway_data_from_csv_file(airport_id, length=True) print('*' * 80) print('Runway lengths', airport_id) print('Runway name', ' ' * 10, 'Runway length') # returned runway names are like 'runway_length_runway' for runway_length in result: length = runway_length.split('_') print('{0}{1:>30}'.format(length[2], result[runway_length])) print('*' * 80)
def elevation_runway(): """ Display the length of all of Seatac airport's runways. Args: None Returns: Displays the length of each runway at Seatac on stdout """ runway_obj = runways() airport_id = "KSEA" result =\ runway_obj.runway_data_from_csv_file(airport_id, elevation=True) print('*' * 80) print('Runway elevations ', airport_id) # returned runway names are like 'runway_elevation_runway' for runway_name in result: runway = runway_name.split('_') print('{0}{1:>30}'.format(runway[2], result[runway_name])) print('*' * 80)
def test_runway_data_from_csv_file_status_true(): runway_obj = runways() result = runway_obj.runway_data_from_csv_file("KSEA", status=True) assert len(result) == 4 assert type(result) == dict
def test_runway_data_from_csv_file_elevation_true(): runway_obj = runways() result = runway_obj.runway_data_from_csv_file("KSEA", elevation=True) assert len(result) == 4 assert type(result) == dict
def test_runway_data_from_csv_file_default_params(): runway_obj = runways() result = runway_obj.runway_data_from_csv_file("KSEA") assert len(result) == 24 assert type(result) == dict