>>> from vehicles import autoritzats >>> import os >>> dic = { ... "camió": "perifèrica", ... "furgoneta": "centre", ... "cotxe elèctric": "centre" ... } >>> autoritzats("exemple_vehicles.txt", "centre.txt", ... "peri.txt", dic, 100.0, 150.0) >>> with open("centre.txt") as f: ... f.read() == "3333CCC\n5555EEE\n" True >>> with open("peri.txt") as f: ... f.read() == "1111AAA\n" True >>> from vehicles import autoritzats >>> import os >>> dic = { ... "camió": "perifèrica", ... "furgoneta": "centre", ... "cotxe elèctric": "centre", ... "cotxe híbrid": "centre", ... "moto": "perifèrica" ... } >>> with open("entrada_vehicles.txt", "w") as f: ... n = f.write( ... "1111AAA;40.0;camió\n" ... "2222BBB;30.0;furgoneta\n" ... "3333CCC;50.0;camió\n" ... "4444DDD;25.0;cotxe elèctric\n" ... "5555EEE;60.0;camió\n" ... "6666FFF;20.0;cotxe híbrid\n" ... "7777GGG;15.0;moto\n" ... "8888HHH;35.0;furgoneta\n" ... ) >>> autoritzats("entrada_vehicles.txt", "zona_centre.txt", "zona_peri.txt", dic, 100.0, 120.0) >>> with open("zona_centre.txt") as f: ... f.read() == "2222BBB\n4444DDD\n6666FFF\n" True >>> with open("zona_peri.txt") as f: ... f.read() == "1111AAA\n3333CCC\n7777GGG\n" True