from functions import add_flight

def test_add():
    l=[]
    add_flight(l,"2421",50,"Cluj-Napoca","Istambul")
    assert l==[{
            "code":"2421",
            "duration":50,
            "dep_city":"Cluj-Napoca",
            "dest_city":"Istambul"
        }]
    print("Added correctly")
    try:
        add_flight(l,"2421",50,"Cluj-Napoca","Istambul")
    except:
        print("Error raised correctly")
    print("It works")

if __name__=="__main__":
    test_add()