from unittest import TestCase
import xml.etree.ElementTree as ET
import os
import sys
sys.path.append('./')
from common import open_xml
from preprocess.sensor_technical_information import get_lane_nodes, get_induction_loop_data, get_dict_sensor_info


class Test(TestCase):

    def test_get_lane_nodes(self):
        xml_file = open_xml('BOS210')
        expected_output = {'1': [[51.683119, 5.2938207], [51.6831637, 
            5.2937967], [51.6832155, 5.293777], [51.6833053, 5.293749], [
            51.6833894, 5.2937353], [51.6835076, 5.293737], [51.6836028, 
            5.2937556], [51.6837162, 5.2938032], [51.6837636, 5.2938189], [
            51.6837928, 5.2938253], [51.6838419, 5.2938227], [51.683881, 
            5.2938087], [51.6839234, 5.2937728], [51.6839593, 5.2937284], [
            51.6840109, 5.2936303], [51.6841845, 5.2932479]], '2': [[
            51.6831293, 5.2938658], [51.683171, 5.2938451], [51.6832201, 
            5.2938209], [51.6833103, 5.2937904], [51.6833891, 5.2937817], [
            51.6835025, 5.2937806], [51.6835961, 5.2938015], [51.6837478, 
            5.2938658], [51.6837956, 5.2938745], [51.6838425, 5.293875], [
            51.6838884, 5.2938603], [51.6839371, 5.29382], [51.6839849, 
            5.293754], [51.6842075, 5.2932765]], '3': [[51.6830694, 
            5.293812], [51.6830559, 5.2937569]], '4': [[51.6831443, 
            5.2940958], [51.6831533, 5.2941303], [51.6831718, 5.294183], [
            51.6831805, 5.294247], [51.6831808, 5.2943294], [51.6831863, 
            5.2943855], [51.6832074, 5.2944668], [51.6834309, 5.2951534], [
            51.6834599, 5.2951944], [51.683502, 5.2952529], [51.6835263, 
            5.2953158], [51.6835686, 5.2954719], [51.6835814, 5.2955293], [
            51.683576, 5.2955781], [51.6835552, 5.2956125], [51.6835379, 
            5.2956344]], '5': [[51.6830947, 5.2938079], [51.6830872, 
            5.2937785]], '6': [[51.6831284, 5.2939377], [51.6831239, 
            5.2939197]], '7': [[51.6830829, 5.2943113], [51.683125, 
            5.2944459], [51.683405, 5.295311], [51.68342, 5.2953568], [
            51.6834673, 5.2955035], [51.6837007, 5.296131], [51.6840029, 
            5.2968934], [51.6840326, 5.2969851], [51.6841001, 5.2972067], [
            51.6841241, 5.2972674], [51.6841636, 5.2973672], [51.6844392, 
            5.2980887]], '8': [[51.6830571, 5.2943308], [51.683099, 
            5.2944669], [51.6833964, 5.2953788], [51.683462, 5.2955679], [
            51.6839775, 5.2969182], [51.6840096, 5.2970006], [51.6841001, 
            5.2972067]], '9': [[51.6829487, 5.2943418], [51.6829089, 
            5.2943681], [51.6828714, 5.2943879], [51.6828335, 5.2943944], [
            51.6827813, 5.2943948], [51.6826949, 5.2943781], [51.6825865, 
            5.2943548], [51.6818106, 5.2941807], [51.6814424, 5.2941666], [
            51.6813442, 5.2941645], [51.6811516, 5.294119], [51.6801231, 
            5.2938913]], '10': [[51.6831148, 5.2942531], [51.6831409, 
            5.294233]], '11': [[51.6830101, 5.2943335], [51.6830211, 
            5.2943248]], '12': [[51.6831071, 5.2942929], [51.683412, 
            5.2952331], [51.683405, 5.295311]], '13': [[51.6828358, 
            5.2942547], [51.6827307, 5.2942916], [51.6826643, 5.2943031], [
            51.6825965, 5.2943011], [51.6825186, 5.2942849], [51.6817095, 
            5.2941061], [51.6815573, 5.2940792], [51.681504, 5.2940671], [
            51.6812757, 5.2940146], [51.6811594, 5.2939867], [51.6809885, 
            5.2939325], [51.6801365, 5.293741]], '14': [[51.682829, 
            5.2942043], [51.6827282, 5.2942427], [51.6826642, 5.2942515], [
            51.6825888, 5.2942495], [51.6825214, 5.294241], [51.6817411, 
            5.2940632], [51.6815636, 5.2940316], [51.681504, 5.2940671]],
            '15': [[51.6831515, 5.2939548], [51.6831954, 5.2939272], [
            51.6832501, 5.293898], [51.6833342, 5.2938686], [51.6834031, 
            5.2938528], [51.6834978, 5.293851], [51.683597, 5.2938652], [
            51.6836913, 5.2938935], [51.6837799, 5.2939392], [51.6838241, 
            5.2939473], [51.6838723, 5.2939387], [51.6839068, 5.2939185], [
            51.6839596, 5.2938718], [51.6840238, 5.2937591], [51.6842327, 
            5.2933148]], '17': [[51.6831667, 5.2940135], [51.6832118, 
            5.2939738], [51.683262, 5.2939415], [51.6833384, 5.2939124], [
            51.6834061, 5.2938984], [51.6834942, 5.2938941], [51.6835917, 
            5.2939105], [51.6836819, 5.2939406], [51.6837734, 5.2939851], [
            51.6838357, 5.2939974], [51.6838734, 5.2939918], [51.6839131, 
            5.293972], [51.6839578, 5.2939317], [51.6839938, 5.293883], [
            51.6840465, 5.2937865], [51.684254, 5.2933428]], '18': [[
            51.6839938, 5.293883], [51.6840555, 5.2938475], [51.6840911, 
            5.2937745], [51.6842758, 5.2933698]], '19': [[51.6829984, 
            5.2943788], [51.6830352, 5.2944856], [51.6830883, 5.294661], [
            51.6833327, 5.2954284], [51.683399, 5.2956209], [51.6834954, 
            5.2958261], [51.6835451, 5.2959261], [51.6835973, 5.2960506]],
            '20': [[51.6830352, 5.2944856], [51.6831093, 5.2946327], [
            51.68336, 5.2954036]], '21': [[51.6831186, 5.2938997], [
            51.6831239, 5.2939197]], '22': [[51.6831601, 5.2940562], [
            51.6831773, 5.2941194]], '23': [[51.6831141, 5.2942157], [
            51.6831433, 5.2941975], [51.6831718, 5.294183]], '24': [[
            51.6830332, 5.2943154], [51.6830211, 5.2943248]], '25': [[
            51.6829684, 5.2943653], [51.6829271, 5.2943921]], '26': [[
            51.6828124, 5.2941116], [51.6827531, 5.2941515], [51.6826961, 
            5.2941847], [51.6826418, 5.2942023], [51.6825907, 5.2942024], [
            51.6818223, 5.2940274], [51.6816178, 5.2939892]], '27': [[
            51.6830559, 5.2937569], [51.683097, 5.2937423], [51.6832877, 
            5.293694], [51.6833738, 5.2936768], [51.6834474, 5.2936721], [
            51.6835235, 5.2936765], [51.6836, 5.2936918], [51.6836871, 
            5.293723], [51.6837441, 5.2937471], [51.6837927, 5.2937553], [
            51.68384, 5.2937505], [51.6838836, 5.2937299], [51.6839312, 
            5.2936917], [51.6839783, 5.2936323], [51.6840262, 5.2935318], [
            51.6841619, 5.2932206]], '28': [[51.6830559, 5.2937569], [
            51.6830119, 5.2937837], [51.682972, 5.2938198], [51.6829092, 
            5.293905], [51.682835, 5.2940061], [51.682768, 5.2940687], [
            51.6827015, 5.2941107], [51.6826417, 5.2941377], [51.6826018, 
            5.2941472], [51.6818378, 5.2939736], [51.6817652, 5.2939573], [
            51.6816302, 5.2938923]], '29': [[51.6831718, 5.294183], [
            51.6832167, 5.2941311], [51.6832804, 5.2940366], [51.6833237, 
            5.2939915], [51.683365, 5.2939676], [51.6834356, 5.2939539], [
            51.6835117, 5.29396], [51.6835759, 5.2939693], [51.6836668, 
            5.2940025], [51.6837388, 5.2940389], [51.6837981, 5.2940602], [
            51.6838635, 5.2940653], [51.683927, 5.2940384], [51.6839838, 
            5.2939913], [51.684032, 5.2939748], [51.6840814, 5.2939904], [
            51.6841928, 5.2941162], [51.6844697, 5.2935114], [51.6844834, 
            5.2934337], [51.6844967, 5.2932785], [51.6845021, 5.2931456]],
            '30': [[51.6835814, 5.2955293], [51.6835954, 5.2955989], [
            51.6835969, 5.2956617], [51.6836048, 5.295731], [51.6836236, 
            5.2957905], [51.683709, 5.2960107], [51.6837271, 5.2961263], [
            51.6840255, 5.2968712], [51.6841421, 5.2972462], [51.6844592, 
            5.2980722]]}
        output_file = get_lane_nodes(xml_file)
        self.assertEqual(output_file, expected_output)

    def test_get_induction_loop_data(self):
        root = open_xml('BOS210')
        name_traffic_signal = get_induction_loop_data(root)
        expected_output = {'011': {'position': ['516830938', '52943482'],
            'length': '100', 'located_on_laneID': '7'}, '012': {'position':
            ['516831526', '52945312'], 'length': '800', 'located_on_laneID':
            '7'}, '013': {'position': ['516832230', '52947491'], 'length':
            '1800', 'located_on_laneID': '7'}, '014': {'position': [
            '516833331', '52950890'], 'length': '100', 'located_on_laneID':
            '7'}, '031': {'position': ['516830667', '52943681'], 'length':
            '100', 'located_on_laneID': '8'}, '032': {'position': [
            '516831260', '52945532'], 'length': '800', 'located_on_laneID':
            '8'}, '033': {'position': ['516831966', '52947713'], 'length':
            '1800', 'located_on_laneID': '8'}, '034': {'position': [
            '516833067', '52951111'], 'length': '100', 'located_on_laneID':
            '8'}, '041': {'position': ['516828131', '52942647'], 'length':
            '100', 'located_on_laneID': '13'}, '042': {'position': [
            '516826856', '52942985'], 'length': '800', 'located_on_laneID':
            '13'}, '043': {'position': ['516825839', '52942976'], 'length':
            '600', 'located_on_laneID': '13'}, '044': {'position': [
            '516817358', '52941130'], 'length': '100', 'located_on_laneID':
            '13'}, '051': {'position': ['516828042', '52942121'], 'length':
            '100', 'located_on_laneID': '14'}, '052': {'position': [
            '516826833', '52942481'], 'length': '800', 'located_on_laneID':
            '14'}, '053': {'position': ['516825868', '52942472'], 'length':
            '600', 'located_on_laneID': '14'}, '054': {'position': [
            '516817149', '52940561'], 'length': '100', 'located_on_laneID':
            '14'}, '111': {'position': ['516831387', '52938096'], 'length':
            '100', 'located_on_laneID': '1'}, '112': {'position': [
            '516832599', '52937619'], 'length': '800', 'located_on_laneID':
            '1'}, '113': {'position': ['516834097', '52937381'], 'length':
            '1800', 'located_on_laneID': '1'}, '114': {'position': [
            '516835569', '52937456'], 'length': '100', 'located_on_laneID':
            '1'}, '121': {'position': ['516831509', '52938551'], 'length':
            '100', 'located_on_laneID': '2'}, '122': {'position': [
            '516832746', '52938016'], 'length': '800', 'located_on_laneID':
            '2'}, '123': {'position': ['516834276', '52937822'], 'length':
            '1800', 'located_on_laneID': '2'}, '124': {'position': [
            '516835808', '52937960'], 'length': '100', 'located_on_laneID':
            '2'}, '221': {'position': ['516829311', '52943595'], 'length':
            '75', 'located_on_laneID': '9'}, '222': {'position': [
            '516827516', '52943952'], 'length': '75', 'located_on_laneID':
            '9'}, '223': {'position': ['516827382', '52943929'], 'length':
            '75', 'located_on_laneID': '9'}, '241': {'position': [
            '516830551', '52937937'], 'length': '75', 'located_on_laneID':
            '3'}, '281': {'position': ['516831547', '52941100'], 'length':
            '75', 'located_on_laneID': '4'}, '411': {'position': [
            '516831167', '52943225'], 'length': '100', 'located_on_laneID':
            '12'}, '412': {'position': ['516831631', '52944652'], 'length':
            '100', 'located_on_laneID': '12'}, 'F055': {'position': [
            '516832962', '52938813'], 'length': '500', 'located_on_laneID':
            '15'}}
        self.assertEqual(name_traffic_signal, expected_output)

    def test_get_dict_sensor_info(self):
        directory_name = 'BOS210'
        sensor_info = get_dict_sensor_info(directory_name)
        expected_output = {'1': {'first_node_lane_id': [51.683119, 
            5.2938207], 'sensors': {'111': {'position': ['516831387',
            '52938096'], 'length': '100', 'located_on_laneID': '1'}, '112':
            {'position': ['516832599', '52937619'], 'length': '800',
            'located_on_laneID': '1'}, '113': {'position': ['516834097',
            '52937381'], 'length': '1800', 'located_on_laneID': '1'}, '114':
            {'position': ['516835569', '52937456'], 'length': '100',
            'located_on_laneID': '1'}}}, '2': {'first_node_lane_id': [
            51.6831293, 5.2938658], 'sensors': {'121': {'position': [
            '516831509', '52938551'], 'length': '100', 'located_on_laneID':
            '2'}, '122': {'position': ['516832746', '52938016'], 'length':
            '800', 'located_on_laneID': '2'}, '123': {'position': [
            '516834276', '52937822'], 'length': '1800', 'located_on_laneID':
            '2'}, '124': {'position': ['516835808', '52937960'], 'length':
            '100', 'located_on_laneID': '2'}}}, '3': {'first_node_lane_id':
            [51.6830694, 5.293812], 'sensors': {'241': {'position': [
            '516830551', '52937937'], 'length': '75', 'located_on_laneID':
            '3'}}}, '4': {'first_node_lane_id': [51.6831443, 5.2940958],
            'sensors': {'281': {'position': ['516831547', '52941100'],
            'length': '75', 'located_on_laneID': '4'}}}, '5': {
            'first_node_lane_id': [51.6830947, 5.2938079], 'sensors': {}},
            '6': {'first_node_lane_id': [51.6831284, 5.2939377], 'sensors':
            {}}, '7': {'first_node_lane_id': [51.6830829, 5.2943113],
            'sensors': {'011': {'position': ['516830938', '52943482'],
            'length': '100', 'located_on_laneID': '7'}, '012': {'position':
            ['516831526', '52945312'], 'length': '800', 'located_on_laneID':
            '7'}, '013': {'position': ['516832230', '52947491'], 'length':
            '1800', 'located_on_laneID': '7'}, '014': {'position': [
            '516833331', '52950890'], 'length': '100', 'located_on_laneID':
            '7'}}}, '8': {'first_node_lane_id': [51.6830571, 5.2943308],
            'sensors': {'031': {'position': ['516830667', '52943681'],
            'length': '100', 'located_on_laneID': '8'}, '032': {'position':
            ['516831260', '52945532'], 'length': '800', 'located_on_laneID':
            '8'}, '033': {'position': ['516831966', '52947713'], 'length':
            '1800', 'located_on_laneID': '8'}, '034': {'position': [
            '516833067', '52951111'], 'length': '100', 'located_on_laneID':
            '8'}}}, '9': {'first_node_lane_id': [51.6829487, 5.2943418],
            'sensors': {'221': {'position': ['516829311', '52943595'],
            'length': '75', 'located_on_laneID': '9'}, '222': {'position':
            ['516827516', '52943952'], 'length': '75', 'located_on_laneID':
            '9'}, '223': {'position': ['516827382', '52943929'], 'length':
            '75', 'located_on_laneID': '9'}}}, '10': {'first_node_lane_id':
            [51.6831148, 5.2942531], 'sensors': {}}, '11': {
            'first_node_lane_id': [51.6830101, 5.2943335], 'sensors': {}},
            '12': {'first_node_lane_id': [51.6831071, 5.2942929], 'sensors':
            {'411': {'position': ['516831167', '52943225'], 'length': '100',
            'located_on_laneID': '12'}, '412': {'position': ['516831631',
            '52944652'], 'length': '100', 'located_on_laneID': '12'}}},
            '13': {'first_node_lane_id': [51.6828358, 5.2942547], 'sensors':
            {'041': {'position': ['516828131', '52942647'], 'length': '100',
            'located_on_laneID': '13'}, '042': {'position': ['516826856',
            '52942985'], 'length': '800', 'located_on_laneID': '13'}, '043':
            {'position': ['516825839', '52942976'], 'length': '600',
            'located_on_laneID': '13'}, '044': {'position': ['516817358',
            '52941130'], 'length': '100', 'located_on_laneID': '13'}}},
            '14': {'first_node_lane_id': [51.682829, 5.2942043], 'sensors':
            {'051': {'position': ['516828042', '52942121'], 'length': '100',
            'located_on_laneID': '14'}, '052': {'position': ['516826833',
            '52942481'], 'length': '800', 'located_on_laneID': '14'}, '053':
            {'position': ['516825868', '52942472'], 'length': '600',
            'located_on_laneID': '14'}, '054': {'position': ['516817149',
            '52940561'], 'length': '100', 'located_on_laneID': '14'}}},
            '15': {'first_node_lane_id': [51.6831515, 5.2939548], 'sensors':
            {'F055': {'position': ['516832962', '52938813'], 'length':
            '500', 'located_on_laneID': '15'}}}, '17': {
            'first_node_lane_id': [51.6831667, 5.2940135], 'sensors': {}},
            '18': {'first_node_lane_id': [51.6839938, 5.293883], 'sensors':
            {}}, '19': {'first_node_lane_id': [51.6829984, 5.2943788],
            'sensors': {}}, '20': {'first_node_lane_id': [51.6830352, 
            5.2944856], 'sensors': {}}, '21': {'first_node_lane_id': [
            51.6831186, 5.2938997], 'sensors': {}}, '22': {
            'first_node_lane_id': [51.6831601, 5.2940562], 'sensors': {}},
            '23': {'first_node_lane_id': [51.6831141, 5.2942157], 'sensors':
            {}}, '24': {'first_node_lane_id': [51.6830332, 5.2943154],
            'sensors': {}}, '25': {'first_node_lane_id': [51.6829684, 
            5.2943653], 'sensors': {}}, '26': {'first_node_lane_id': [
            51.6828124, 5.2941116], 'sensors': {}}, '27': {
            'first_node_lane_id': [51.6830559, 5.2937569], 'sensors': {}},
            '28': {'first_node_lane_id': [51.6830559, 5.2937569], 'sensors':
            {}}, '29': {'first_node_lane_id': [51.6831718, 5.294183],
            'sensors': {}}, '30': {'first_node_lane_id': [51.6835814, 
            5.2955293], 'sensors': {}}}
        self.assertEqual(sensor_info, expected_output)

45c995fdb1ab0c33d5a95ecc99f3a7c393eb908d
<mask token>


class Test(TestCase):

    def test_get_lane_nodes(self):
        xml_file = open_xml('BOS210')
        expected_output = {'1': [[51.683119, 5.2938207], [51.6831637, 
            5.2937967], [51.6832155, 5.293777], [51.6833053, 5.293749], [
            51.6833894, 5.2937353], [51.6835076, 5.293737], [51.6836028, 
            5.2937556], [51.6837162, 5.2938032], [51.6837636, 5.2938189], [
            51.6837928, 5.2938253], [51.6838419, 5.2938227], [51.683881, 
            5.2938087], [51.6839234, 5.2937728], [51.6839593, 5.2937284], [
            51.6840109, 5.2936303], [51.6841845, 5.2932479]], '2': [[
            51.6831293, 5.2938658], [51.683171, 5.2938451], [51.6832201, 
            5.2938209], [51.6833103, 5.2937904], [51.6833891, 5.2937817], [
            51.6835025, 5.2937806], [51.6835961, 5.2938015], [51.6837478, 
            5.2938658], [51.6837956, 5.2938745], [51.6838425, 5.293875], [
            51.6838884, 5.2938603], [51.6839371, 5.29382], [51.6839849, 
            5.293754], [51.6842075, 5.2932765]], '3': [[51.6830694, 
            5.293812], [51.6830559, 5.2937569]], '4': [[51.6831443, 
            5.2940958], [51.6831533, 5.2941303], [51.6831718, 5.294183], [
            51.6831805, 5.294247], [51.6831808, 5.2943294], [51.6831863, 
            5.2943855], [51.6832074, 5.2944668], [51.6834309, 5.2951534], [
            51.6834599, 5.2951944], [51.683502, 5.2952529], [51.6835263, 
            5.2953158], [51.6835686, 5.2954719], [51.6835814, 5.2955293], [
            51.683576, 5.2955781], [51.6835552, 5.2956125], [51.6835379, 
            5.2956344]], '5': [[51.6830947, 5.2938079], [51.6830872, 
            5.2937785]], '6': [[51.6831284, 5.2939377], [51.6831239, 
            5.2939197]], '7': [[51.6830829, 5.2943113], [51.683125, 
            5.2944459], [51.683405, 5.295311], [51.68342, 5.2953568], [
            51.6834673, 5.2955035], [51.6837007, 5.296131], [51.6840029, 
            5.2968934], [51.6840326, 5.2969851], [51.6841001, 5.2972067], [
            51.6841241, 5.2972674], [51.6841636, 5.2973672], [51.6844392, 
            5.2980887]], '8': [[51.6830571, 5.2943308], [51.683099, 
            5.2944669], [51.6833964, 5.2953788], [51.683462, 5.2955679], [
            51.6839775, 5.2969182], [51.6840096, 5.2970006], [51.6841001, 
            5.2972067]], '9': [[51.6829487, 5.2943418], [51.6829089, 
            5.2943681], [51.6828714, 5.2943879], [51.6828335, 5.2943944], [
            51.6827813, 5.2943948], [51.6826949, 5.2943781], [51.6825865, 
            5.2943548], [51.6818106, 5.2941807], [51.6814424, 5.2941666], [
            51.6813442, 5.2941645], [51.6811516, 5.294119], [51.6801231, 
            5.2938913]], '10': [[51.6831148, 5.2942531], [51.6831409, 
            5.294233]], '11': [[51.6830101, 5.2943335], [51.6830211, 
            5.2943248]], '12': [[51.6831071, 5.2942929], [51.683412, 
            5.2952331], [51.683405, 5.295311]], '13': [[51.6828358, 
            5.2942547], [51.6827307, 5.2942916], [51.6826643, 5.2943031], [
            51.6825965, 5.2943011], [51.6825186, 5.2942849], [51.6817095, 
            5.2941061], [51.6815573, 5.2940792], [51.681504, 5.2940671], [
            51.6812757, 5.2940146], [51.6811594, 5.2939867], [51.6809885, 
            5.2939325], [51.6801365, 5.293741]], '14': [[51.682829, 
            5.2942043], [51.6827282, 5.2942427], [51.6826642, 5.2942515], [
            51.6825888, 5.2942495], [51.6825214, 5.294241], [51.6817411, 
            5.2940632], [51.6815636, 5.2940316], [51.681504, 5.2940671]],
            '15': [[51.6831515, 5.2939548], [51.6831954, 5.2939272], [
            51.6832501, 5.293898], [51.6833342, 5.2938686], [51.6834031, 
            5.2938528], [51.6834978, 5.293851], [51.683597, 5.2938652], [
            51.6836913, 5.2938935], [51.6837799, 5.2939392], [51.6838241, 
            5.2939473], [51.6838723, 5.2939387], [51.6839068, 5.2939185], [
            51.6839596, 5.2938718], [51.6840238, 5.2937591], [51.6842327, 
            5.2933148]], '17': [[51.6831667, 5.2940135], [51.6832118, 
            5.2939738], [51.683262, 5.2939415], [51.6833384, 5.2939124], [
            51.6834061, 5.2938984], [51.6834942, 5.2938941], [51.6835917, 
            5.2939105], [51.6836819, 5.2939406], [51.6837734, 5.2939851], [
            51.6838357, 5.2939974], [51.6838734, 5.2939918], [51.6839131, 
            5.293972], [51.6839578, 5.2939317], [51.6839938, 5.293883], [
            51.6840465, 5.2937865], [51.684254, 5.2933428]], '18': [[
            51.6839938, 5.293883], [51.6840555, 5.2938475], [51.6840911, 
            5.2937745], [51.6842758, 5.2933698]], '19': [[51.6829984, 
            5.2943788], [51.6830352, 5.2944856], [51.6830883, 5.294661], [
            51.6833327, 5.2954284], [51.683399, 5.2956209], [51.6834954, 
            5.2958261], [51.6835451, 5.2959261], [51.6835973, 5.2960506]],
            '20': [[51.6830352, 5.2944856], [51.6831093, 5.2946327], [
            51.68336, 5.2954036]], '21': [[51.6831186, 5.2938997], [
            51.6831239, 5.2939197]], '22': [[51.6831601, 5.2940562], [
            51.6831773, 5.2941194]], '23': [[51.6831141, 5.2942157], [
            51.6831433, 5.2941975], [51.6831718, 5.294183]], '24': [[
            51.6830332, 5.2943154], [51.6830211, 5.2943248]], '25': [[
            51.6829684, 5.2943653], [51.6829271, 5.2943921]], '26': [[
            51.6828124, 5.2941116], [51.6827531, 5.2941515], [51.6826961, 
            5.2941847], [51.6826418, 5.2942023], [51.6825907, 5.2942024], [
            51.6818223, 5.2940274], [51.6816178, 5.2939892]], '27': [[
            51.6830559, 5.2937569], [51.683097, 5.2937423], [51.6832877, 
            5.293694], [51.6833738, 5.2936768], [51.6834474, 5.2936721], [
            51.6835235, 5.2936765], [51.6836, 5.2936918], [51.6836871, 
            5.293723], [51.6837441, 5.2937471], [51.6837927, 5.2937553], [
            51.68384, 5.2937505], [51.6838836, 5.2937299], [51.6839312, 
            5.2936917], [51.6839783, 5.2936323], [51.6840262, 5.2935318], [
            51.6841619, 5.2932206]], '28': [[51.6830559, 5.2937569], [
            51.6830119, 5.2937837], [51.682972, 5.2938198], [51.6829092, 
            5.293905], [51.682835, 5.2940061], [51.682768, 5.2940687], [
            51.6827015, 5.2941107], [51.6826417, 5.2941377], [51.6826018, 
            5.2941472], [51.6818378, 5.2939736], [51.6817652, 5.2939573], [
            51.6816302, 5.2938923]], '29': [[51.6831718, 5.294183], [
            51.6832167, 5.2941311], [51.6832804, 5.2940366], [51.6833237, 
            5.2939915], [51.683365, 5.2939676], [51.6834356, 5.2939539], [
            51.6835117, 5.29396], [51.6835759, 5.2939693], [51.6836668, 
            5.2940025], [51.6837388, 5.2940389], [51.6837981, 5.2940602], [
            51.6838635, 5.2940653], [51.683927, 5.2940384], [51.6839838, 
            5.2939913], [51.684032, 5.2939748], [51.6840814, 5.2939904], [
            51.6841928, 5.2941162], [51.6844697, 5.2935114], [51.6844834, 
            5.2934337], [51.6844967, 5.2932785], [51.6845021, 5.2931456]],
            '30': [[51.6835814, 5.2955293], [51.6835954, 5.2955989], [
            51.6835969, 5.2956617], [51.6836048, 5.295731], [51.6836236, 
            5.2957905], [51.683709, 5.2960107], [51.6837271, 5.2961263], [
            51.6840255, 5.2968712], [51.6841421, 5.2972462], [51.6844592, 
            5.2980722]]}
        output_file = get_lane_nodes(xml_file)
        self.assertEqual(output_file, expected_output)

    def test_get_induction_loop_data(self):
        root = open_xml('BOS210')
        name_traffic_signal = get_induction_loop_data(root)
        expected_output = {'011': {'position': ['516830938', '52943482'],
            'length': '100', 'located_on_laneID': '7'}, '012': {'position':
            ['516831526', '52945312'], 'length': '800', 'located_on_laneID':
            '7'}, '013': {'position': ['516832230', '52947491'], 'length':
            '1800', 'located_on_laneID': '7'}, '014': {'position': [
            '516833331', '52950890'], 'length': '100', 'located_on_laneID':
            '7'}, '031': {'position': ['516830667', '52943681'], 'length':
            '100', 'located_on_laneID': '8'}, '032': {'position': [
            '516831260', '52945532'], 'length': '800', 'located_on_laneID':
            '8'}, '033': {'position': ['516831966', '52947713'], 'length':
            '1800', 'located_on_laneID': '8'}, '034': {'position': [
            '516833067', '52951111'], 'length': '100', 'located_on_laneID':
            '8'}, '041': {'position': ['516828131', '52942647'], 'length':
            '100', 'located_on_laneID': '13'}, '042': {'position': [
            '516826856', '52942985'], 'length': '800', 'located_on_laneID':
            '13'}, '043': {'position': ['516825839', '52942976'], 'length':
            '600', 'located_on_laneID': '13'}, '044': {'position': [
            '516817358', '52941130'], 'length': '100', 'located_on_laneID':
            '13'}, '051': {'position': ['516828042', '52942121'], 'length':
            '100', 'located_on_laneID': '14'}, '052': {'position': [
            '516826833', '52942481'], 'length': '800', 'located_on_laneID':
            '14'}, '053': {'position': ['516825868', '52942472'], 'length':
            '600', 'located_on_laneID': '14'}, '054': {'position': [
            '516817149', '52940561'], 'length': '100', 'located_on_laneID':
            '14'}, '111': {'position': ['516831387', '52938096'], 'length':
            '100', 'located_on_laneID': '1'}, '112': {'position': [
            '516832599', '52937619'], 'length': '800', 'located_on_laneID':
            '1'}, '113': {'position': ['516834097', '52937381'], 'length':
            '1800', 'located_on_laneID': '1'}, '114': {'position': [
            '516835569', '52937456'], 'length': '100', 'located_on_laneID':
            '1'}, '121': {'position': ['516831509', '52938551'], 'length':
            '100', 'located_on_laneID': '2'}, '122': {'position': [
            '516832746', '52938016'], 'length': '800', 'located_on_laneID':
            '2'}, '123': {'position': ['516834276', '52937822'], 'length':
            '1800', 'located_on_laneID': '2'}, '124': {'position': [
            '516835808', '52937960'], 'length': '100', 'located_on_laneID':
            '2'}, '221': {'position': ['516829311', '52943595'], 'length':
            '75', 'located_on_laneID': '9'}, '222': {'position': [
            '516827516', '52943952'], 'length': '75', 'located_on_laneID':
            '9'}, '223': {'position': ['516827382', '52943929'], 'length':
            '75', 'located_on_laneID': '9'}, '241': {'position': [
            '516830551', '52937937'], 'length': '75', 'located_on_laneID':
            '3'}, '281': {'position': ['516831547', '52941100'], 'length':
            '75', 'located_on_laneID': '4'}, '411': {'position': [
            '516831167', '52943225'], 'length': '100', 'located_on_laneID':
            '12'}, '412': {'position': ['516831631', '52944652'], 'length':
            '100', 'located_on_laneID': '12'}, 'F055': {'position': [
            '516832962', '52938813'], 'length': '500', 'located_on_laneID':
            '15'}}
        self.assertEqual(name_traffic_signal, expected_output)
    <mask token>

<mask token>


class Test(TestCase):

    def test_get_lane_nodes(self):
        xml_file = open_xml('BOS210')
        expected_output = {'1': [[51.683119, 5.2938207], [51.6831637, 
            5.2937967], [51.6832155, 5.293777], [51.6833053, 5.293749], [
            51.6833894, 5.2937353], [51.6835076, 5.293737], [51.6836028, 
            5.2937556], [51.6837162, 5.2938032], [51.6837636, 5.2938189], [
            51.6837928, 5.2938253], [51.6838419, 5.2938227], [51.683881, 
            5.2938087], [51.6839234, 5.2937728], [51.6839593, 5.2937284], [
            51.6840109, 5.2936303], [51.6841845, 5.2932479]], '2': [[
            51.6831293, 5.2938658], [51.683171, 5.2938451], [51.6832201, 
            5.2938209], [51.6833103, 5.2937904], [51.6833891, 5.2937817], [
            51.6835025, 5.2937806], [51.6835961, 5.2938015], [51.6837478, 
            5.2938658], [51.6837956, 5.2938745], [51.6838425, 5.293875], [
            51.6838884, 5.2938603], [51.6839371, 5.29382], [51.6839849, 
            5.293754], [51.6842075, 5.2932765]], '3': [[51.6830694, 
            5.293812], [51.6830559, 5.2937569]], '4': [[51.6831443, 
            5.2940958], [51.6831533, 5.2941303], [51.6831718, 5.294183], [
            51.6831805, 5.294247], [51.6831808, 5.2943294], [51.6831863, 
            5.2943855], [51.6832074, 5.2944668], [51.6834309, 5.2951534], [
            51.6834599, 5.2951944], [51.683502, 5.2952529], [51.6835263, 
            5.2953158], [51.6835686, 5.2954719], [51.6835814, 5.2955293], [
            51.683576, 5.2955781], [51.6835552, 5.2956125], [51.6835379, 
            5.2956344]], '5': [[51.6830947, 5.2938079], [51.6830872, 
            5.2937785]], '6': [[51.6831284, 5.2939377], [51.6831239, 
            5.2939197]], '7': [[51.6830829, 5.2943113], [51.683125, 
            5.2944459], [51.683405, 5.295311], [51.68342, 5.2953568], [
            51.6834673, 5.2955035], [51.6837007, 5.296131], [51.6840029, 
            5.2968934], [51.6840326, 5.2969851], [51.6841001, 5.2972067], [
            51.6841241, 5.2972674], [51.6841636, 5.2973672], [51.6844392, 
            5.2980887]], '8': [[51.6830571, 5.2943308], [51.683099, 
            5.2944669], [51.6833964, 5.2953788], [51.683462, 5.2955679], [
            51.6839775, 5.2969182], [51.6840096, 5.2970006], [51.6841001, 
            5.2972067]], '9': [[51.6829487, 5.2943418], [51.6829089, 
            5.2943681], [51.6828714, 5.2943879], [51.6828335, 5.2943944], [
            51.6827813, 5.2943948], [51.6826949, 5.2943781], [51.6825865, 
            5.2943548], [51.6818106, 5.2941807], [51.6814424, 5.2941666], [
            51.6813442, 5.2941645], [51.6811516, 5.294119], [51.6801231, 
            5.2938913]], '10': [[51.6831148, 5.2942531], [51.6831409, 
            5.294233]], '11': [[51.6830101, 5.2943335], [51.6830211, 
            5.2943248]], '12': [[51.6831071, 5.2942929], [51.683412, 
            5.2952331], [51.683405, 5.295311]], '13': [[51.6828358, 
            5.2942547], [51.6827307, 5.2942916], [51.6826643, 5.2943031], [
            51.6825965, 5.2943011], [51.6825186, 5.2942849], [51.6817095, 
            5.2941061], [51.6815573, 5.2940792], [51.681504, 5.2940671], [
            51.6812757, 5.2940146], [51.6811594, 5.2939867], [51.6809885, 
            5.2939325], [51.6801365, 5.293741]], '14': [[51.682829, 
            5.2942043], [51.6827282, 5.2942427], [51.6826642, 5.2942515], [
            51.6825888, 5.2942495], [51.6825214, 5.294241], [51.6817411, 
            5.2940632], [51.6815636, 5.2940316], [51.681504, 5.2940671]],
            '15': [[51.6831515, 5.2939548], [51.6831954, 5.2939272], [
            51.6832501, 5.293898], [51.6833342, 5.2938686], [51.6834031, 
            5.2938528], [51.6834978, 5.293851], [51.683597, 5.2938652], [
            51.6836913, 5.2938935], [51.6837799, 5.2939392], [51.6838241, 
            5.2939473], [51.6838723, 5.2939387], [51.6839068, 5.2939185], [
            51.6839596, 5.2938718], [51.6840238, 5.2937591], [51.6842327, 
            5.2933148]], '17': [[51.6831667, 5.2940135], [51.6832118, 
            5.2939738], [51.683262, 5.2939415], [51.6833384, 5.2939124], [
            51.6834061, 5.2938984], [51.6834942, 5.2938941], [51.6835917, 
            5.2939105], [51.6836819, 5.2939406], [51.6837734, 5.2939851], [
            51.6838357, 5.2939974], [51.6838734, 5.2939918], [51.6839131, 
            5.293972], [51.6839578, 5.2939317], [51.6839938, 5.293883], [
            51.6840465, 5.2937865], [51.684254, 5.2933428]], '18': [[
            51.6839938, 5.293883], [51.6840555, 5.2938475], [51.6840911, 
            5.2937745], [51.6842758, 5.2933698]], '19': [[51.6829984, 
            5.2943788], [51.6830352, 5.2944856], [51.6830883, 5.294661], [
            51.6833327, 5.2954284], [51.683399, 5.2956209], [51.6834954, 
            5.2958261], [51.6835451, 5.2959261], [51.6835973, 5.2960506]],
            '20': [[51.6830352, 5.2944856], [51.6831093, 5.2946327], [
            51.68336, 5.2954036]], '21': [[51.6831186, 5.2938997], [
            51.6831239, 5.2939197]], '22': [[51.6831601, 5.2940562], [
            51.6831773, 5.2941194]], '23': [[51.6831141, 5.2942157], [
            51.6831433, 5.2941975], [51.6831718, 5.294183]], '24': [[
            51.6830332, 5.2943154], [51.6830211, 5.2943248]], '25': [[
            51.6829684, 5.2943653], [51.6829271, 5.2943921]], '26': [[
            51.6828124, 5.2941116], [51.6827531, 5.2941515], [51.6826961, 
            5.2941847], [51.6826418, 5.2942023], [51.6825907, 5.2942024], [
            51.6818223, 5.2940274], [51.6816178, 5.2939892]], '27': [[
            51.6830559, 5.2937569], [51.683097, 5.2937423], [51.6832877, 
            5.293694], [51.6833738, 5.2936768], [51.6834474, 5.2936721], [
            51.6835235, 5.2936765], [51.6836, 5.2936918], [51.6836871, 
            5.293723], [51.6837441, 5.2937471], [51.6837927, 5.2937553], [
            51.68384, 5.2937505], [51.6838836, 5.2937299], [51.6839312, 
            5.2936917], [51.6839783, 5.2936323], [51.6840262, 5.2935318], [
            51.6841619, 5.2932206]], '28': [[51.6830559, 5.2937569], [
            51.6830119, 5.2937837], [51.682972, 5.2938198], [51.6829092, 
            5.293905], [51.682835, 5.2940061], [51.682768, 5.2940687], [
            51.6827015, 5.2941107], [51.6826417, 5.2941377], [51.6826018, 
            5.2941472], [51.6818378, 5.2939736], [51.6817652, 5.2939573], [
            51.6816302, 5.2938923]], '29': [[51.6831718, 5.294183], [
            51.6832167, 5.2941311], [51.6832804, 5.2940366], [51.6833237, 
            5.2939915], [51.683365, 5.2939676], [51.6834356, 5.2939539], [
            51.6835117, 5.29396], [51.6835759, 5.2939693], [51.6836668, 
            5.2940025], [51.6837388, 5.2940389], [51.6837981, 5.2940602], [
            51.6838635, 5.2940653], [51.683927, 5.2940384], [51.6839838, 
            5.2939913], [51.684032, 5.2939748], [51.6840814, 5.2939904], [
            51.6841928, 5.2941162], [51.6844697, 5.2935114], [51.6844834, 
            5.2934337], [51.6844967, 5.2932785], [51.6845021, 5.2931456]],
            '30': [[51.6835814, 5.2955293], [51.6835954, 5.2955989], [
            51.6835969, 5.2956617], [51.6836048, 5.295731], [51.6836236, 
            5.2957905], [51.683709, 5.2960107], [51.6837271, 5.2961263], [
            51.6840255, 5.2968712], [51.6841421, 5.2972462], [51.6844592, 
            5.2980722]]}
        output_file = get_lane_nodes(xml_file)
        self.assertEqual(output_file, expected_output)

    def test_get_induction_loop_data(self):
        root = open_xml('BOS210')
        name_traffic_signal = get_induction_loop_data(root)
        expected_output = {'011': {'position': ['516830938', '52943482'],
            'length': '100', 'located_on_laneID': '7'}, '012': {'position':
            ['516831526', '52945312'], 'length': '800', 'located_on_laneID':
            '7'}, '013': {'position': ['516832230', '52947491'], 'length':
            '1800', 'located_on_laneID': '7'}, '014': {'position': [
            '516833331', '52950890'], 'length': '100', 'located_on_laneID':
            '7'}, '031': {'position': ['516830667', '52943681'], 'length':
            '100', 'located_on_laneID': '8'}, '032': {'position': [
            '516831260', '52945532'], 'length': '800', 'located_on_laneID':
            '8'}, '033': {'position': ['516831966', '52947713'], 'length':
            '1800', 'located_on_laneID': '8'}, '034': {'position': [
            '516833067', '52951111'], 'length': '100', 'located_on_laneID':
            '8'}, '041': {'position': ['516828131', '52942647'], 'length':
            '100', 'located_on_laneID': '13'}, '042': {'position': [
            '516826856', '52942985'], 'length': '800', 'located_on_laneID':
            '13'}, '043': {'position': ['516825839', '52942976'], 'length':
            '600', 'located_on_laneID': '13'}, '044': {'position': [
            '516817358', '52941130'], 'length': '100', 'located_on_laneID':
            '13'}, '051': {'position': ['516828042', '52942121'], 'length':
            '100', 'located_on_laneID': '14'}, '052': {'position': [
            '516826833', '52942481'], 'length': '800', 'located_on_laneID':
            '14'}, '053': {'position': ['516825868', '52942472'], 'length':
            '600', 'located_on_laneID': '14'}, '054': {'position': [
            '516817149', '52940561'], 'length': '100', 'located_on_laneID':
            '14'}, '111': {'position': ['516831387', '52938096'], 'length':
            '100', 'located_on_laneID': '1'}, '112': {'position': [
            '516832599', '52937619'], 'length': '800', 'located_on_laneID':
            '1'}, '113': {'position': ['516834097', '52937381'], 'length':
            '1800', 'located_on_laneID': '1'}, '114': {'position': [
            '516835569', '52937456'], 'length': '100', 'located_on_laneID':
            '1'}, '121': {'position': ['516831509', '52938551'], 'length':
            '100', 'located_on_laneID': '2'}, '122': {'position': [
            '516832746', '52938016'], 'length': '800', 'located_on_laneID':
            '2'}, '123': {'position': ['516834276', '52937822'], 'length':
            '1800', 'located_on_laneID': '2'}, '124': {'position': [
            '516835808', '52937960'], 'length': '100', 'located_on_laneID':
            '2'}, '221': {'position': ['516829311', '52943595'], 'length':
            '75', 'located_on_laneID': '9'}, '222': {'position': [
            '516827516', '52943952'], 'length': '75', 'located_on_laneID':
            '9'}, '223': {'position': ['516827382', '52943929'], 'length':
            '75', 'located_on_laneID': '9'}, '241': {'position': [
            '516830551', '52937937'], 'length': '75', 'located_on_laneID':
            '3'}, '281': {'position': ['516831547', '52941100'], 'length':
            '75', 'located_on_laneID': '4'}, '411': {'position': [
            '516831167', '52943225'], 'length': '100', 'located_on_laneID':
            '12'}, '412': {'position': ['516831631', '52944652'], 'length':
            '100', 'located_on_laneID': '12'}, 'F055': {'position': [
            '516832962', '52938813'], 'length': '500', 'located_on_laneID':
            '15'}}
        self.assertEqual(name_traffic_signal, expected_output)

    def test_get_dict_sensor_info(self):
        directory_name = 'BOS210'
        sensor_info = get_dict_sensor_info(directory_name)
        expected_output = {'1': {'first_node_lane_id': [51.683119, 
            5.2938207], 'sensors': {'111': {'position': ['516831387',
            '52938096'], 'length': '100', 'located_on_laneID': '1'}, '112':
            {'position': ['516832599', '52937619'], 'length': '800',
            'located_on_laneID': '1'}, '113': {'position': ['516834097',
            '52937381'], 'length': '1800', 'located_on_laneID': '1'}, '114':
            {'position': ['516835569', '52937456'], 'length': '100',
            'located_on_laneID': '1'}}}, '2': {'first_node_lane_id': [
            51.6831293, 5.2938658], 'sensors': {'121': {'position': [
            '516831509', '52938551'], 'length': '100', 'located_on_laneID':
            '2'}, '122': {'position': ['516832746', '52938016'], 'length':
            '800', 'located_on_laneID': '2'}, '123': {'position': [
            '516834276', '52937822'], 'length': '1800', 'located_on_laneID':
            '2'}, '124': {'position': ['516835808', '52937960'], 'length':
            '100', 'located_on_laneID': '2'}}}, '3': {'first_node_lane_id':
            [51.6830694, 5.293812], 'sensors': {'241': {'position': [
            '516830551', '52937937'], 'length': '75', 'located_on_laneID':
            '3'}}}, '4': {'first_node_lane_id': [51.6831443, 5.2940958],
            'sensors': {'281': {'position': ['516831547', '52941100'],
            'length': '75', 'located_on_laneID': '4'}}}, '5': {
            'first_node_lane_id': [51.6830947, 5.2938079], 'sensors': {}},
            '6': {'first_node_lane_id': [51.6831284, 5.2939377], 'sensors':
            {}}, '7': {'first_node_lane_id': [51.6830829, 5.2943113],
            'sensors': {'011': {'position': ['516830938', '52943482'],
            'length': '100', 'located_on_laneID': '7'}, '012': {'position':
            ['516831526', '52945312'], 'length': '800', 'located_on_laneID':
            '7'}, '013': {'position': ['516832230', '52947491'], 'length':
            '1800', 'located_on_laneID': '7'}, '014': {'position': [
            '516833331', '52950890'], 'length': '100', 'located_on_laneID':
            '7'}}}, '8': {'first_node_lane_id': [51.6830571, 5.2943308],
            'sensors': {'031': {'position': ['516830667', '52943681'],
            'length': '100', 'located_on_laneID': '8'}, '032': {'position':
            ['516831260', '52945532'], 'length': '800', 'located_on_laneID':
            '8'}, '033': {'position': ['516831966', '52947713'], 'length':
            '1800', 'located_on_laneID': '8'}, '034': {'position': [
            '516833067', '52951111'], 'length': '100', 'located_on_laneID':
            '8'}}}, '9': {'first_node_lane_id': [51.6829487, 5.2943418],
            'sensors': {'221': {'position': ['516829311', '52943595'],
            'length': '75', 'located_on_laneID': '9'}, '222': {'position':
            ['516827516', '52943952'], 'length': '75', 'located_on_laneID':
            '9'}, '223': {'position': ['516827382', '52943929'], 'length':
            '75', 'located_on_laneID': '9'}}}, '10': {'first_node_lane_id':
            [51.6831148, 5.2942531], 'sensors': {}}, '11': {
            'first_node_lane_id': [51.6830101, 5.2943335], 'sensors': {}},
            '12': {'first_node_lane_id': [51.6831071, 5.2942929], 'sensors':
            {'411': {'position': ['516831167', '52943225'], 'length': '100',
            'located_on_laneID': '12'}, '412': {'position': ['516831631',
            '52944652'], 'length': '100', 'located_on_laneID': '12'}}},
            '13': {'first_node_lane_id': [51.6828358, 5.2942547], 'sensors':
            {'041': {'position': ['516828131', '52942647'], 'length': '100',
            'located_on_laneID': '13'}, '042': {'position': ['516826856',
            '52942985'], 'length': '800', 'located_on_laneID': '13'}, '043':
            {'position': ['516825839', '52942976'], 'length': '600',
            'located_on_laneID': '13'}, '044': {'position': ['516817358',
            '52941130'], 'length': '100', 'located_on_laneID': '13'}}},
            '14': {'first_node_lane_id': [51.682829, 5.2942043], 'sensors':
            {'051': {'position': ['516828042', '52942121'], 'length': '100',
            'located_on_laneID': '14'}, '052': {'position': ['516826833',
            '52942481'], 'length': '800', 'located_on_laneID': '14'}, '053':
            {'position': ['516825868', '52942472'], 'length': '600',
            'located_on_laneID': '14'}, '054': {'position': ['516817149',
            '52940561'], 'length': '100', 'located_on_laneID': '14'}}},
            '15': {'first_node_lane_id': [51.6831515, 5.2939548], 'sensors':
            {'F055': {'position': ['516832962', '52938813'], 'length':
            '500', 'located_on_laneID': '15'}}}, '17': {
            'first_node_lane_id': [51.6831667, 5.2940135], 'sensors': {}},
            '18': {'first_node_lane_id': [51.6839938, 5.293883], 'sensors':
            {}}, '19': {'first_node_lane_id': [51.6829984, 5.2943788],
            'sensors': {}}, '20': {'first_node_lane_id': [51.6830352, 
            5.2944856], 'sensors': {}}, '21': {'first_node_lane_id': [
            51.6831186, 5.2938997], 'sensors': {}}, '22': {
            'first_node_lane_id': [51.6831601, 5.2940562], 'sensors': {}},
            '23': {'first_node_lane_id': [51.6831141, 5.2942157], 'sensors':
            {}}, '24': {'first_node_lane_id': [51.6830332, 5.2943154],
            'sensors': {}}, '25': {'first_node_lane_id': [51.6829684, 
            5.2943653], 'sensors': {}}, '26': {'first_node_lane_id': [
            51.6828124, 5.2941116], 'sensors': {}}, '27': {
            'first_node_lane_id': [51.6830559, 5.2937569], 'sensors': {}},
            '28': {'first_node_lane_id': [51.6830559, 5.2937569], 'sensors':
            {}}, '29': {'first_node_lane_id': [51.6831718, 5.294183],
            'sensors': {}}, '30': {'first_node_lane_id': [51.6835814, 
            5.2955293], 'sensors': {}}}
        self.assertEqual(sensor_info, expected_output)

<mask token>
sys.path.append('./')
<mask token>


class Test(TestCase):

    def test_get_lane_nodes(self):
        xml_file = open_xml('BOS210')
        expected_output = {'1': [[51.683119, 5.2938207], [51.6831637, 
            5.2937967], [51.6832155, 5.293777], [51.6833053, 5.293749], [
            51.6833894, 5.2937353], [51.6835076, 5.293737], [51.6836028, 
            5.2937556], [51.6837162, 5.2938032], [51.6837636, 5.2938189], [
            51.6837928, 5.2938253], [51.6838419, 5.2938227], [51.683881, 
            5.2938087], [51.6839234, 5.2937728], [51.6839593, 5.2937284], [
            51.6840109, 5.2936303], [51.6841845, 5.2932479]], '2': [[
            51.6831293, 5.2938658], [51.683171, 5.2938451], [51.6832201, 
            5.2938209], [51.6833103, 5.2937904], [51.6833891, 5.2937817], [
            51.6835025, 5.2937806], [51.6835961, 5.2938015], [51.6837478, 
            5.2938658], [51.6837956, 5.2938745], [51.6838425, 5.293875], [
            51.6838884, 5.2938603], [51.6839371, 5.29382], [51.6839849, 
            5.293754], [51.6842075, 5.2932765]], '3': [[51.6830694, 
            5.293812], [51.6830559, 5.2937569]], '4': [[51.6831443, 
            5.2940958], [51.6831533, 5.2941303], [51.6831718, 5.294183], [
            51.6831805, 5.294247], [51.6831808, 5.2943294], [51.6831863, 
            5.2943855], [51.6832074, 5.2944668], [51.6834309, 5.2951534], [
            51.6834599, 5.2951944], [51.683502, 5.2952529], [51.6835263, 
            5.2953158], [51.6835686, 5.2954719], [51.6835814, 5.2955293], [
            51.683576, 5.2955781], [51.6835552, 5.2956125], [51.6835379, 
            5.2956344]], '5': [[51.6830947, 5.2938079], [51.6830872, 
            5.2937785]], '6': [[51.6831284, 5.2939377], [51.6831239, 
            5.2939197]], '7': [[51.6830829, 5.2943113], [51.683125, 
            5.2944459], [51.683405, 5.295311], [51.68342, 5.2953568], [
            51.6834673, 5.2955035], [51.6837007, 5.296131], [51.6840029, 
            5.2968934], [51.6840326, 5.2969851], [51.6841001, 5.2972067], [
            51.6841241, 5.2972674], [51.6841636, 5.2973672], [51.6844392, 
            5.2980887]], '8': [[51.6830571, 5.2943308], [51.683099, 
            5.2944669], [51.6833964, 5.2953788], [51.683462, 5.2955679], [
            51.6839775, 5.2969182], [51.6840096, 5.2970006], [51.6841001, 
            5.2972067]], '9': [[51.6829487, 5.2943418], [51.6829089, 
            5.2943681], [51.6828714, 5.2943879], [51.6828335, 5.2943944], [
            51.6827813, 5.2943948], [51.6826949, 5.2943781], [51.6825865, 
            5.2943548], [51.6818106, 5.2941807], [51.6814424, 5.2941666], [
            51.6813442, 5.2941645], [51.6811516, 5.294119], [51.6801231, 
            5.2938913]], '10': [[51.6831148, 5.2942531], [51.6831409, 
            5.294233]], '11': [[51.6830101, 5.2943335], [51.6830211, 
            5.2943248]], '12': [[51.6831071, 5.2942929], [51.683412, 
            5.2952331], [51.683405, 5.295311]], '13': [[51.6828358, 
            5.2942547], [51.6827307, 5.2942916], [51.6826643, 5.2943031], [
            51.6825965, 5.2943011], [51.6825186, 5.2942849], [51.6817095, 
            5.2941061], [51.6815573, 5.2940792], [51.681504, 5.2940671], [
            51.6812757, 5.2940146], [51.6811594, 5.2939867], [51.6809885, 
            5.2939325], [51.6801365, 5.293741]], '14': [[51.682829, 
            5.2942043], [51.6827282, 5.2942427], [51.6826642, 5.2942515], [
            51.6825888, 5.2942495], [51.6825214, 5.294241], [51.6817411, 
            5.2940632], [51.6815636, 5.2940316], [51.681504, 5.2940671]],
            '15': [[51.6831515, 5.2939548], [51.6831954, 5.2939272], [
            51.6832501, 5.293898], [51.6833342, 5.2938686], [51.6834031, 
            5.2938528], [51.6834978, 5.293851], [51.683597, 5.2938652], [
            51.6836913, 5.2938935], [51.6837799, 5.2939392], [51.6838241, 
            5.2939473], [51.6838723, 5.2939387], [51.6839068, 5.2939185], [
            51.6839596, 5.2938718], [51.6840238, 5.2937591], [51.6842327, 
            5.2933148]], '17': [[51.6831667, 5.2940135], [51.6832118, 
            5.2939738], [51.683262, 5.2939415], [51.6833384, 5.2939124], [
            51.6834061, 5.2938984], [51.6834942, 5.2938941], [51.6835917, 
            5.2939105], [51.6836819, 5.2939406], [51.6837734, 5.2939851], [
            51.6838357, 5.2939974], [51.6838734, 5.2939918], [51.6839131, 
            5.293972], [51.6839578, 5.2939317], [51.6839938, 5.293883], [
            51.6840465, 5.2937865], [51.684254, 5.2933428]], '18': [[
            51.6839938, 5.293883], [51.6840555, 5.2938475], [51.6840911, 
            5.2937745], [51.6842758, 5.2933698]], '19': [[51.6829984, 
            5.2943788], [51.6830352, 5.2944856], [51.6830883, 5.294661], [
            51.6833327, 5.2954284], [51.683399, 5.2956209], [51.6834954, 
            5.2958261], [51.6835451, 5.2959261], [51.6835973, 5.2960506]],
            '20': [[51.6830352, 5.2944856], [51.6831093, 5.2946327], [
            51.68336, 5.2954036]], '21': [[51.6831186, 5.2938997], [
            51.6831239, 5.2939197]], '22': [[51.6831601, 5.2940562], [
            51.6831773, 5.2941194]], '23': [[51.6831141, 5.2942157], [
            51.6831433, 5.2941975], [51.6831718, 5.294183]], '24': [[
            51.6830332, 5.2943154], [51.6830211, 5.2943248]], '25': [[
            51.6829684, 5.2943653], [51.6829271, 5.2943921]], '26': [[
            51.6828124, 5.2941116], [51.6827531, 5.2941515], [51.6826961, 
            5.2941847], [51.6826418, 5.2942023], [51.6825907, 5.2942024], [
            51.6818223, 5.2940274], [51.6816178, 5.2939892]], '27': [[
            51.6830559, 5.2937569], [51.683097, 5.2937423], [51.6832877, 
            5.293694], [51.6833738, 5.2936768], [51.6834474, 5.2936721], [
            51.6835235, 5.2936765], [51.6836, 5.2936918], [51.6836871, 
            5.293723], [51.6837441, 5.2937471], [51.6837927, 5.2937553], [
            51.68384, 5.2937505], [51.6838836, 5.2937299], [51.6839312, 
            5.2936917], [51.6839783, 5.2936323], [51.6840262, 5.2935318], [
            51.6841619, 5.2932206]], '28': [[51.6830559, 5.2937569], [
            51.6830119, 5.2937837], [51.682972, 5.2938198], [51.6829092, 
            5.293905], [51.682835, 5.2940061], [51.682768, 5.2940687], [
            51.6827015, 5.2941107], [51.6826417, 5.2941377], [51.6826018, 
            5.2941472], [51.6818378, 5.2939736], [51.6817652, 5.2939573], [
            51.6816302, 5.2938923]], '29': [[51.6831718, 5.294183], [
            51.6832167, 5.2941311], [51.6832804, 5.2940366], [51.6833237, 
            5.2939915], [51.683365, 5.2939676], [51.6834356, 5.2939539], [
            51.6835117, 5.29396], [51.6835759, 5.2939693], [51.6836668, 
            5.2940025], [51.6837388, 5.2940389], [51.6837981, 5.2940602], [
            51.6838635, 5.2940653], [51.683927, 5.2940384], [51.6839838, 
            5.2939913], [51.684032, 5.2939748], [51.6840814, 5.2939904], [
            51.6841928, 5.2941162], [51.6844697, 5.2935114], [51.6844834, 
            5.2934337], [51.6844967, 5.2932785], [51.6845021, 5.2931456]],
            '30': [[51.6835814, 5.2955293], [51.6835954, 5.2955989], [
            51.6835969, 5.2956617], [51.6836048, 5.295731], [51.6836236, 
            5.2957905], [51.683709, 5.2960107], [51.6837271, 5.2961263], [
            51.6840255, 5.2968712], [51.6841421, 5.2972462], [51.6844592, 
            5.2980722]]}
        output_file = get_lane_nodes(xml_file)
        self.assertEqual(output_file, expected_output)

    def test_get_induction_loop_data(self):
        root = open_xml('BOS210')
        name_traffic_signal = get_induction_loop_data(root)
        expected_output = {'011': {'position': ['516830938', '52943482'],
            'length': '100', 'located_on_laneID': '7'}, '012': {'position':
            ['516831526', '52945312'], 'length': '800', 'located_on_laneID':
            '7'}, '013': {'position': ['516832230', '52947491'], 'length':
            '1800', 'located_on_laneID': '7'}, '014': {'position': [
            '516833331', '52950890'], 'length': '100', 'located_on_laneID':
            '7'}, '031': {'position': ['516830667', '52943681'], 'length':
            '100', 'located_on_laneID': '8'}, '032': {'position': [
            '516831260', '52945532'], 'length': '800', 'located_on_laneID':
            '8'}, '033': {'position': ['516831966', '52947713'], 'length':
            '1800', 'located_on_laneID': '8'}, '034': {'position': [
            '516833067', '52951111'], 'length': '100', 'located_on_laneID':
            '8'}, '041': {'position': ['516828131', '52942647'], 'length':
            '100', 'located_on_laneID': '13'}, '042': {'position': [
            '516826856', '52942985'], 'length': '800', 'located_on_laneID':
            '13'}, '043': {'position': ['516825839', '52942976'], 'length':
            '600', 'located_on_laneID': '13'}, '044': {'position': [
            '516817358', '52941130'], 'length': '100', 'located_on_laneID':
            '13'}, '051': {'position': ['516828042', '52942121'], 'length':
            '100', 'located_on_laneID': '14'}, '052': {'position': [
            '516826833', '52942481'], 'length': '800', 'located_on_laneID':
            '14'}, '053': {'position': ['516825868', '52942472'], 'length':
            '600', 'located_on_laneID': '14'}, '054': {'position': [
            '516817149', '52940561'], 'length': '100', 'located_on_laneID':
            '14'}, '111': {'position': ['516831387', '52938096'], 'length':
            '100', 'located_on_laneID': '1'}, '112': {'position': [
            '516832599', '52937619'], 'length': '800', 'located_on_laneID':
            '1'}, '113': {'position': ['516834097', '52937381'], 'length':
            '1800', 'located_on_laneID': '1'}, '114': {'position': [
            '516835569', '52937456'], 'length': '100', 'located_on_laneID':
            '1'}, '121': {'position': ['516831509', '52938551'], 'length':
            '100', 'located_on_laneID': '2'}, '122': {'position': [
            '516832746', '52938016'], 'length': '800', 'located_on_laneID':
            '2'}, '123': {'position': ['516834276', '52937822'], 'length':
            '1800', 'located_on_laneID': '2'}, '124': {'position': [
            '516835808', '52937960'], 'length': '100', 'located_on_laneID':
            '2'}, '221': {'position': ['516829311', '52943595'], 'length':
            '75', 'located_on_laneID': '9'}, '222': {'position': [
            '516827516', '52943952'], 'length': '75', 'located_on_laneID':
            '9'}, '223': {'position': ['516827382', '52943929'], 'length':
            '75', 'located_on_laneID': '9'}, '241': {'position': [
            '516830551', '52937937'], 'length': '75', 'located_on_laneID':
            '3'}, '281': {'position': ['516831547', '52941100'], 'length':
            '75', 'located_on_laneID': '4'}, '411': {'position': [
            '516831167', '52943225'], 'length': '100', 'located_on_laneID':
            '12'}, '412': {'position': ['516831631', '52944652'], 'length':
            '100', 'located_on_laneID': '12'}, 'F055': {'position': [
            '516832962', '52938813'], 'length': '500', 'located_on_laneID':
            '15'}}
        self.assertEqual(name_traffic_signal, expected_output)

    def test_get_dict_sensor_info(self):
        directory_name = 'BOS210'
        sensor_info = get_dict_sensor_info(directory_name)
        expected_output = {'1': {'first_node_lane_id': [51.683119, 
            5.2938207], 'sensors': {'111': {'position': ['516831387',
            '52938096'], 'length': '100', 'located_on_laneID': '1'}, '112':
            {'position': ['516832599', '52937619'], 'length': '800',
            'located_on_laneID': '1'}, '113': {'position': ['516834097',
            '52937381'], 'length': '1800', 'located_on_laneID': '1'}, '114':
            {'position': ['516835569', '52937456'], 'length': '100',
            'located_on_laneID': '1'}}}, '2': {'first_node_lane_id': [
            51.6831293, 5.2938658], 'sensors': {'121': {'position': [
            '516831509', '52938551'], 'length': '100', 'located_on_laneID':
            '2'}, '122': {'position': ['516832746', '52938016'], 'length':
            '800', 'located_on_laneID': '2'}, '123': {'position': [
            '516834276', '52937822'], 'length': '1800', 'located_on_laneID':
            '2'}, '124': {'position': ['516835808', '52937960'], 'length':
            '100', 'located_on_laneID': '2'}}}, '3': {'first_node_lane_id':
            [51.6830694, 5.293812], 'sensors': {'241': {'position': [
            '516830551', '52937937'], 'length': '75', 'located_on_laneID':
            '3'}}}, '4': {'first_node_lane_id': [51.6831443, 5.2940958],
            'sensors': {'281': {'position': ['516831547', '52941100'],
            'length': '75', 'located_on_laneID': '4'}}}, '5': {
            'first_node_lane_id': [51.6830947, 5.2938079], 'sensors': {}},
            '6': {'first_node_lane_id': [51.6831284, 5.2939377], 'sensors':
            {}}, '7': {'first_node_lane_id': [51.6830829, 5.2943113],
            'sensors': {'011': {'position': ['516830938', '52943482'],
            'length': '100', 'located_on_laneID': '7'}, '012': {'position':
            ['516831526', '52945312'], 'length': '800', 'located_on_laneID':
            '7'}, '013': {'position': ['516832230', '52947491'], 'length':
            '1800', 'located_on_laneID': '7'}, '014': {'position': [
            '516833331', '52950890'], 'length': '100', 'located_on_laneID':
            '7'}}}, '8': {'first_node_lane_id': [51.6830571, 5.2943308],
            'sensors': {'031': {'position': ['516830667', '52943681'],
            'length': '100', 'located_on_laneID': '8'}, '032': {'position':
            ['516831260', '52945532'], 'length': '800', 'located_on_laneID':
            '8'}, '033': {'position': ['516831966', '52947713'], 'length':
            '1800', 'located_on_laneID': '8'}, '034': {'position': [
            '516833067', '52951111'], 'length': '100', 'located_on_laneID':
            '8'}}}, '9': {'first_node_lane_id': [51.6829487, 5.2943418],
            'sensors': {'221': {'position': ['516829311', '52943595'],
            'length': '75', 'located_on_laneID': '9'}, '222': {'position':
            ['516827516', '52943952'], 'length': '75', 'located_on_laneID':
            '9'}, '223': {'position': ['516827382', '52943929'], 'length':
            '75', 'located_on_laneID': '9'}}}, '10': {'first_node_lane_id':
            [51.6831148, 5.2942531], 'sensors': {}}, '11': {
            'first_node_lane_id': [51.6830101, 5.2943335], 'sensors': {}},
            '12': {'first_node_lane_id': [51.6831071, 5.2942929], 'sensors':
            {'411': {'position': ['516831167', '52943225'], 'length': '100',
            'located_on_laneID': '12'}, '412': {'position': ['516831631',
            '52944652'], 'length': '100', 'located_on_laneID': '12'}}},
            '13': {'first_node_lane_id': [51.6828358, 5.2942547], 'sensors':
            {'041': {'position': ['516828131', '52942647'], 'length': '100',
            'located_on_laneID': '13'}, '042': {'position': ['516826856',
            '52942985'], 'length': '800', 'located_on_laneID': '13'}, '043':
            {'position': ['516825839', '52942976'], 'length': '600',
            'located_on_laneID': '13'}, '044': {'position': ['516817358',
            '52941130'], 'length': '100', 'located_on_laneID': '13'}}},
            '14': {'first_node_lane_id': [51.682829, 5.2942043], 'sensors':
            {'051': {'position': ['516828042', '52942121'], 'length': '100',
            'located_on_laneID': '14'}, '052': {'position': ['516826833',
            '52942481'], 'length': '800', 'located_on_laneID': '14'}, '053':
            {'position': ['516825868', '52942472'], 'length': '600',
            'located_on_laneID': '14'}, '054': {'position': ['516817149',
            '52940561'], 'length': '100', 'located_on_laneID': '14'}}},
            '15': {'first_node_lane_id': [51.6831515, 5.2939548], 'sensors':
            {'F055': {'position': ['516832962', '52938813'], 'length':
            '500', 'located_on_laneID': '15'}}}, '17': {
            'first_node_lane_id': [51.6831667, 5.2940135], 'sensors': {}},
            '18': {'first_node_lane_id': [51.6839938, 5.293883], 'sensors':
            {}}, '19': {'first_node_lane_id': [51.6829984, 5.2943788],
            'sensors': {}}, '20': {'first_node_lane_id': [51.6830352, 
            5.2944856], 'sensors': {}}, '21': {'first_node_lane_id': [
            51.6831186, 5.2938997], 'sensors': {}}, '22': {
            'first_node_lane_id': [51.6831601, 5.2940562], 'sensors': {}},
            '23': {'first_node_lane_id': [51.6831141, 5.2942157], 'sensors':
            {}}, '24': {'first_node_lane_id': [51.6830332, 5.2943154],
            'sensors': {}}, '25': {'first_node_lane_id': [51.6829684, 
            5.2943653], 'sensors': {}}, '26': {'first_node_lane_id': [
            51.6828124, 5.2941116], 'sensors': {}}, '27': {
            'first_node_lane_id': [51.6830559, 5.2937569], 'sensors': {}},
            '28': {'first_node_lane_id': [51.6830559, 5.2937569], 'sensors':
            {}}, '29': {'first_node_lane_id': [51.6831718, 5.294183],
            'sensors': {}}, '30': {'first_node_lane_id': [51.6835814, 
            5.2955293], 'sensors': {}}}
        self.assertEqual(sensor_info, expected_output)

from unittest import TestCase
import xml.etree.ElementTree as ET
import os
import sys
sys.path.append('./')
from common import open_xml
from preprocess.sensor_technical_information import get_lane_nodes, get_induction_loop_data, get_dict_sensor_info


class Test(TestCase):

    def test_get_lane_nodes(self):
        xml_file = open_xml('BOS210')
        expected_output = {'1': [[51.683119, 5.2938207], [51.6831637, 
            5.2937967], [51.6832155, 5.293777], [51.6833053, 5.293749], [
            51.6833894, 5.2937353], [51.6835076, 5.293737], [51.6836028, 
            5.2937556], [51.6837162, 5.2938032], [51.6837636, 5.2938189], [
            51.6837928, 5.2938253], [51.6838419, 5.2938227], [51.683881, 
            5.2938087], [51.6839234, 5.2937728], [51.6839593, 5.2937284], [
            51.6840109, 5.2936303], [51.6841845, 5.2932479]], '2': [[
            51.6831293, 5.2938658], [51.683171, 5.2938451], [51.6832201, 
            5.2938209], [51.6833103, 5.2937904], [51.6833891, 5.2937817], [
            51.6835025, 5.2937806], [51.6835961, 5.2938015], [51.6837478, 
            5.2938658], [51.6837956, 5.2938745], [51.6838425, 5.293875], [
            51.6838884, 5.2938603], [51.6839371, 5.29382], [51.6839849, 
            5.293754], [51.6842075, 5.2932765]], '3': [[51.6830694, 
            5.293812], [51.6830559, 5.2937569]], '4': [[51.6831443, 
            5.2940958], [51.6831533, 5.2941303], [51.6831718, 5.294183], [
            51.6831805, 5.294247], [51.6831808, 5.2943294], [51.6831863, 
            5.2943855], [51.6832074, 5.2944668], [51.6834309, 5.2951534], [
            51.6834599, 5.2951944], [51.683502, 5.2952529], [51.6835263, 
            5.2953158], [51.6835686, 5.2954719], [51.6835814, 5.2955293], [
            51.683576, 5.2955781], [51.6835552, 5.2956125], [51.6835379, 
            5.2956344]], '5': [[51.6830947, 5.2938079], [51.6830872, 
            5.2937785]], '6': [[51.6831284, 5.2939377], [51.6831239, 
            5.2939197]], '7': [[51.6830829, 5.2943113], [51.683125, 
            5.2944459], [51.683405, 5.295311], [51.68342, 5.2953568], [
            51.6834673, 5.2955035], [51.6837007, 5.296131], [51.6840029, 
            5.2968934], [51.6840326, 5.2969851], [51.6841001, 5.2972067], [
            51.6841241, 5.2972674], [51.6841636, 5.2973672], [51.6844392, 
            5.2980887]], '8': [[51.6830571, 5.2943308], [51.683099, 
            5.2944669], [51.6833964, 5.2953788], [51.683462, 5.2955679], [
            51.6839775, 5.2969182], [51.6840096, 5.2970006], [51.6841001, 
            5.2972067]], '9': [[51.6829487, 5.2943418], [51.6829089, 
            5.2943681], [51.6828714, 5.2943879], [51.6828335, 5.2943944], [
            51.6827813, 5.2943948], [51.6826949, 5.2943781], [51.6825865, 
            5.2943548], [51.6818106, 5.2941807], [51.6814424, 5.2941666], [
            51.6813442, 5.2941645], [51.6811516, 5.294119], [51.6801231, 
            5.2938913]], '10': [[51.6831148, 5.2942531], [51.6831409, 
            5.294233]], '11': [[51.6830101, 5.2943335], [51.6830211, 
            5.2943248]], '12': [[51.6831071, 5.2942929], [51.683412, 
            5.2952331], [51.683405, 5.295311]], '13': [[51.6828358, 
            5.2942547], [51.6827307, 5.2942916], [51.6826643, 5.2943031], [
            51.6825965, 5.2943011], [51.6825186, 5.2942849], [51.6817095, 
            5.2941061], [51.6815573, 5.2940792], [51.681504, 5.2940671], [
            51.6812757, 5.2940146], [51.6811594, 5.2939867], [51.6809885, 
            5.2939325], [51.6801365, 5.293741]], '14': [[51.682829, 
            5.2942043], [51.6827282, 5.2942427], [51.6826642, 5.2942515], [
            51.6825888, 5.2942495], [51.6825214, 5.294241], [51.6817411, 
            5.2940632], [51.6815636, 5.2940316], [51.681504, 5.2940671]],
            '15': [[51.6831515, 5.2939548], [51.6831954, 5.2939272], [
            51.6832501, 5.293898], [51.6833342, 5.2938686], [51.6834031, 
            5.2938528], [51.6834978, 5.293851], [51.683597, 5.2938652], [
            51.6836913, 5.2938935], [51.6837799, 5.2939392], [51.6838241, 
            5.2939473], [51.6838723, 5.2939387], [51.6839068, 5.2939185], [
            51.6839596, 5.2938718], [51.6840238, 5.2937591], [51.6842327, 
            5.2933148]], '17': [[51.6831667, 5.2940135], [51.6832118, 
            5.2939738], [51.683262, 5.2939415], [51.6833384, 5.2939124], [
            51.6834061, 5.2938984], [51.6834942, 5.2938941], [51.6835917, 
            5.2939105], [51.6836819, 5.2939406], [51.6837734, 5.2939851], [
            51.6838357, 5.2939974], [51.6838734, 5.2939918], [51.6839131, 
            5.293972], [51.6839578, 5.2939317], [51.6839938, 5.293883], [
            51.6840465, 5.2937865], [51.684254, 5.2933428]], '18': [[
            51.6839938, 5.293883], [51.6840555, 5.2938475], [51.6840911, 
            5.2937745], [51.6842758, 5.2933698]], '19': [[51.6829984, 
            5.2943788], [51.6830352, 5.2944856], [51.6830883, 5.294661], [
            51.6833327, 5.2954284], [51.683399, 5.2956209], [51.6834954, 
            5.2958261], [51.6835451, 5.2959261], [51.6835973, 5.2960506]],
            '20': [[51.6830352, 5.2944856], [51.6831093, 5.2946327], [
            51.68336, 5.2954036]], '21': [[51.6831186, 5.2938997], [
            51.6831239, 5.2939197]], '22': [[51.6831601, 5.2940562], [
            51.6831773, 5.2941194]], '23': [[51.6831141, 5.2942157], [
            51.6831433, 5.2941975], [51.6831718, 5.294183]], '24': [[
            51.6830332, 5.2943154], [51.6830211, 5.2943248]], '25': [[
            51.6829684, 5.2943653], [51.6829271, 5.2943921]], '26': [[
            51.6828124, 5.2941116], [51.6827531, 5.2941515], [51.6826961, 
            5.2941847], [51.6826418, 5.2942023], [51.6825907, 5.2942024], [
            51.6818223, 5.2940274], [51.6816178, 5.2939892]], '27': [[
            51.6830559, 5.2937569], [51.683097, 5.2937423], [51.6832877, 
            5.293694], [51.6833738, 5.2936768], [51.6834474, 5.2936721], [
            51.6835235, 5.2936765], [51.6836, 5.2936918], [51.6836871, 
            5.293723], [51.6837441, 5.2937471], [51.6837927, 5.2937553], [
            51.68384, 5.2937505], [51.6838836, 5.2937299], [51.6839312, 
            5.2936917], [51.6839783, 5.2936323], [51.6840262, 5.2935318], [
            51.6841619, 5.2932206]], '28': [[51.6830559, 5.2937569], [
            51.6830119, 5.2937837], [51.682972, 5.2938198], [51.6829092, 
            5.293905], [51.682835, 5.2940061], [51.682768, 5.2940687], [
            51.6827015, 5.2941107], [51.6826417, 5.2941377], [51.6826018, 
            5.2941472], [51.6818378, 5.2939736], [51.6817652, 5.2939573], [
            51.6816302, 5.2938923]], '29': [[51.6831718, 5.294183], [
            51.6832167, 5.2941311], [51.6832804, 5.2940366], [51.6833237, 
            5.2939915], [51.683365, 5.2939676], [51.6834356, 5.2939539], [
            51.6835117, 5.29396], [51.6835759, 5.2939693], [51.6836668, 
            5.2940025], [51.6837388, 5.2940389], [51.6837981, 5.2940602], [
            51.6838635, 5.2940653], [51.683927, 5.2940384], [51.6839838, 
            5.2939913], [51.684032, 5.2939748], [51.6840814, 5.2939904], [
            51.6841928, 5.2941162], [51.6844697, 5.2935114], [51.6844834, 
            5.2934337], [51.6844967, 5.2932785], [51.6845021, 5.2931456]],
            '30': [[51.6835814, 5.2955293], [51.6835954, 5.2955989], [
            51.6835969, 5.2956617], [51.6836048, 5.295731], [51.6836236, 
            5.2957905], [51.683709, 5.2960107], [51.6837271, 5.2961263], [
            51.6840255, 5.2968712], [51.6841421, 5.2972462], [51.6844592, 
            5.2980722]]}
        output_file = get_lane_nodes(xml_file)
        self.assertEqual(output_file, expected_output)

    def test_get_induction_loop_data(self):
        root = open_xml('BOS210')
        name_traffic_signal = get_induction_loop_data(root)
        expected_output = {'011': {'position': ['516830938', '52943482'],
            'length': '100', 'located_on_laneID': '7'}, '012': {'position':
            ['516831526', '52945312'], 'length': '800', 'located_on_laneID':
            '7'}, '013': {'position': ['516832230', '52947491'], 'length':
            '1800', 'located_on_laneID': '7'}, '014': {'position': [
            '516833331', '52950890'], 'length': '100', 'located_on_laneID':
            '7'}, '031': {'position': ['516830667', '52943681'], 'length':
            '100', 'located_on_laneID': '8'}, '032': {'position': [
            '516831260', '52945532'], 'length': '800', 'located_on_laneID':
            '8'}, '033': {'position': ['516831966', '52947713'], 'length':
            '1800', 'located_on_laneID': '8'}, '034': {'position': [
            '516833067', '52951111'], 'length': '100', 'located_on_laneID':
            '8'}, '041': {'position': ['516828131', '52942647'], 'length':
            '100', 'located_on_laneID': '13'}, '042': {'position': [
            '516826856', '52942985'], 'length': '800', 'located_on_laneID':
            '13'}, '043': {'position': ['516825839', '52942976'], 'length':
            '600', 'located_on_laneID': '13'}, '044': {'position': [
            '516817358', '52941130'], 'length': '100', 'located_on_laneID':
            '13'}, '051': {'position': ['516828042', '52942121'], 'length':
            '100', 'located_on_laneID': '14'}, '052': {'position': [
            '516826833', '52942481'], 'length': '800', 'located_on_laneID':
            '14'}, '053': {'position': ['516825868', '52942472'], 'length':
            '600', 'located_on_laneID': '14'}, '054': {'position': [
            '516817149', '52940561'], 'length': '100', 'located_on_laneID':
            '14'}, '111': {'position': ['516831387', '52938096'], 'length':
            '100', 'located_on_laneID': '1'}, '112': {'position': [
            '516832599', '52937619'], 'length': '800', 'located_on_laneID':
            '1'}, '113': {'position': ['516834097', '52937381'], 'length':
            '1800', 'located_on_laneID': '1'}, '114': {'position': [
            '516835569', '52937456'], 'length': '100', 'located_on_laneID':
            '1'}, '121': {'position': ['516831509', '52938551'], 'length':
            '100', 'located_on_laneID': '2'}, '122': {'position': [
            '516832746', '52938016'], 'length': '800', 'located_on_laneID':
            '2'}, '123': {'position': ['516834276', '52937822'], 'length':
            '1800', 'located_on_laneID': '2'}, '124': {'position': [
            '516835808', '52937960'], 'length': '100', 'located_on_laneID':
            '2'}, '221': {'position': ['516829311', '52943595'], 'length':
            '75', 'located_on_laneID': '9'}, '222': {'position': [
            '516827516', '52943952'], 'length': '75', 'located_on_laneID':
            '9'}, '223': {'position': ['516827382', '52943929'], 'length':
            '75', 'located_on_laneID': '9'}, '241': {'position': [
            '516830551', '52937937'], 'length': '75', 'located_on_laneID':
            '3'}, '281': {'position': ['516831547', '52941100'], 'length':
            '75', 'located_on_laneID': '4'}, '411': {'position': [
            '516831167', '52943225'], 'length': '100', 'located_on_laneID':
            '12'}, '412': {'position': ['516831631', '52944652'], 'length':
            '100', 'located_on_laneID': '12'}, 'F055': {'position': [
            '516832962', '52938813'], 'length': '500', 'located_on_laneID':
            '15'}}
        self.assertEqual(name_traffic_signal, expected_output)

    def test_get_dict_sensor_info(self):
        directory_name = 'BOS210'
        sensor_info = get_dict_sensor_info(directory_name)
        expected_output = {'1': {'first_node_lane_id': [51.683119, 
            5.2938207], 'sensors': {'111': {'position': ['516831387',
            '52938096'], 'length': '100', 'located_on_laneID': '1'}, '112':
            {'position': ['516832599', '52937619'], 'length': '800',
            'located_on_laneID': '1'}, '113': {'position': ['516834097',
            '52937381'], 'length': '1800', 'located_on_laneID': '1'}, '114':
            {'position': ['516835569', '52937456'], 'length': '100',
            'located_on_laneID': '1'}}}, '2': {'first_node_lane_id': [
            51.6831293, 5.2938658], 'sensors': {'121': {'position': [
            '516831509', '52938551'], 'length': '100', 'located_on_laneID':
            '2'}, '122': {'position': ['516832746', '52938016'], 'length':
            '800', 'located_on_laneID': '2'}, '123': {'position': [
            '516834276', '52937822'], 'length': '1800', 'located_on_laneID':
            '2'}, '124': {'position': ['516835808', '52937960'], 'length':
            '100', 'located_on_laneID': '2'}}}, '3': {'first_node_lane_id':
            [51.6830694, 5.293812], 'sensors': {'241': {'position': [
            '516830551', '52937937'], 'length': '75', 'located_on_laneID':
            '3'}}}, '4': {'first_node_lane_id': [51.6831443, 5.2940958],
            'sensors': {'281': {'position': ['516831547', '52941100'],
            'length': '75', 'located_on_laneID': '4'}}}, '5': {
            'first_node_lane_id': [51.6830947, 5.2938079], 'sensors': {}},
            '6': {'first_node_lane_id': [51.6831284, 5.2939377], 'sensors':
            {}}, '7': {'first_node_lane_id': [51.6830829, 5.2943113],
            'sensors': {'011': {'position': ['516830938', '52943482'],
            'length': '100', 'located_on_laneID': '7'}, '012': {'position':
            ['516831526', '52945312'], 'length': '800', 'located_on_laneID':
            '7'}, '013': {'position': ['516832230', '52947491'], 'length':
            '1800', 'located_on_laneID': '7'}, '014': {'position': [
            '516833331', '52950890'], 'length': '100', 'located_on_laneID':
            '7'}}}, '8': {'first_node_lane_id': [51.6830571, 5.2943308],
            'sensors': {'031': {'position': ['516830667', '52943681'],
            'length': '100', 'located_on_laneID': '8'}, '032': {'position':
            ['516831260', '52945532'], 'length': '800', 'located_on_laneID':
            '8'}, '033': {'position': ['516831966', '52947713'], 'length':
            '1800', 'located_on_laneID': '8'}, '034': {'position': [
            '516833067', '52951111'], 'length': '100', 'located_on_laneID':
            '8'}}}, '9': {'first_node_lane_id': [51.6829487, 5.2943418],
            'sensors': {'221': {'position': ['516829311', '52943595'],
            'length': '75', 'located_on_laneID': '9'}, '222': {'position':
            ['516827516', '52943952'], 'length': '75', 'located_on_laneID':
            '9'}, '223': {'position': ['516827382', '52943929'], 'length':
            '75', 'located_on_laneID': '9'}}}, '10': {'first_node_lane_id':
            [51.6831148, 5.2942531], 'sensors': {}}, '11': {
            'first_node_lane_id': [51.6830101, 5.2943335], 'sensors': {}},
            '12': {'first_node_lane_id': [51.6831071, 5.2942929], 'sensors':
            {'411': {'position': ['516831167', '52943225'], 'length': '100',
            'located_on_laneID': '12'}, '412': {'position': ['516831631',
            '52944652'], 'length': '100', 'located_on_laneID': '12'}}},
            '13': {'first_node_lane_id': [51.6828358, 5.2942547], 'sensors':
            {'041': {'position': ['516828131', '52942647'], 'length': '100',
            'located_on_laneID': '13'}, '042': {'position': ['516826856',
            '52942985'], 'length': '800', 'located_on_laneID': '13'}, '043':
            {'position': ['516825839', '52942976'], 'length': '600',
            'located_on_laneID': '13'}, '044': {'position': ['516817358',
            '52941130'], 'length': '100', 'located_on_laneID': '13'}}},
            '14': {'first_node_lane_id': [51.682829, 5.2942043], 'sensors':
            {'051': {'position': ['516828042', '52942121'], 'length': '100',
            'located_on_laneID': '14'}, '052': {'position': ['516826833',
            '52942481'], 'length': '800', 'located_on_laneID': '14'}, '053':
            {'position': ['516825868', '52942472'], 'length': '600',
            'located_on_laneID': '14'}, '054': {'position': ['516817149',
            '52940561'], 'length': '100', 'located_on_laneID': '14'}}},
            '15': {'first_node_lane_id': [51.6831515, 5.2939548], 'sensors':
            {'F055': {'position': ['516832962', '52938813'], 'length':
            '500', 'located_on_laneID': '15'}}}, '17': {
            'first_node_lane_id': [51.6831667, 5.2940135], 'sensors': {}},
            '18': {'first_node_lane_id': [51.6839938, 5.293883], 'sensors':
            {}}, '19': {'first_node_lane_id': [51.6829984, 5.2943788],
            'sensors': {}}, '20': {'first_node_lane_id': [51.6830352, 
            5.2944856], 'sensors': {}}, '21': {'first_node_lane_id': [
            51.6831186, 5.2938997], 'sensors': {}}, '22': {
            'first_node_lane_id': [51.6831601, 5.2940562], 'sensors': {}},
            '23': {'first_node_lane_id': [51.6831141, 5.2942157], 'sensors':
            {}}, '24': {'first_node_lane_id': [51.6830332, 5.2943154],
            'sensors': {}}, '25': {'first_node_lane_id': [51.6829684, 
            5.2943653], 'sensors': {}}, '26': {'first_node_lane_id': [
            51.6828124, 5.2941116], 'sensors': {}}, '27': {
            'first_node_lane_id': [51.6830559, 5.2937569], 'sensors': {}},
            '28': {'first_node_lane_id': [51.6830559, 5.2937569], 'sensors':
            {}}, '29': {'first_node_lane_id': [51.6831718, 5.294183],
            'sensors': {}}, '30': {'first_node_lane_id': [51.6835814, 
            5.2955293], 'sensors': {}}}
        self.assertEqual(sensor_info, expected_output)
