@@ -48,7 +48,7 @@ def test_add_itinerary(self):
4848 Test adding a new task to the task list.
4949 Verify that the task is successfully added and the list size increases.
5050 """
51- test_itinerary = [ {
51+ test_itinerary = {
5252 "name" : "trip" , "location" : "Japan" , "description" : "description" , "start_date" : "12-12-2026" , "end_date" : "28-01-2027" , "flights" : [{
5353 "flight name" : "Perth to Narita" ,
5454 "departure airport" : "Perth" ,
@@ -76,7 +76,7 @@ def test_add_itinerary(self):
7676 "summary" : "A lovely dinner spot" ,
7777 "tag(s)" : "dinner, romantic"
7878 }
79- ]}]
79+ ]}
8080
8181 result = add_itinerary (self .itineraries , name = test_itinerary ["name" ], location = test_itinerary ["location" ], description = test_itinerary ["description" ], start_date = test_itinerary ["start_date" ], end_date = test_itinerary ["end_date" ], flights = test_itinerary ["flights" ], attractions = test_itinerary ["attractions" ])
8282
@@ -86,10 +86,10 @@ def test_add_itinerary(self):
8686
8787 def test_add_duplicate_itinerary (self ):
8888 """
89- Test adding a duplicate task with the same title.
90- Verify that duplicates are not allowed and the function returns False.
89+ Test adding a duplicate itinerary with the same title but different values, then a complete copy of the itinerary .
90+ Verify that these itineraries are not allowed and the function returns False.
9191 """
92- test_itinerary = [ {
92+ test_itinerary = {
9393 "name" : "trip" , "location" : "Japan" , "description" : "description" , "start_date" : "12-12-2026" , "end_date" : "28-01-2027" , "flights" : [{
9494 "flight name" : "Perth to Narita" ,
9595 "departure airport" : "Perth" ,
@@ -117,11 +117,16 @@ def test_add_duplicate_itinerary(self):
117117 "summary" : "A lovely dinner spot" ,
118118 "tag(s)" : "dinner, romantic"
119119 }
120- ]}]
120+ ]}
121121
122- add_itinerary (self .itineraries , "Test Task" , "Description" , "01-12-2021" , "Pending" )
123- result = add_itinerary (self .itineraries , "Test Task" , "New Description" , "02-12-2024" , "Pending" )
124- self .assertFalse (result )
122+ add_itinerary (self .itineraries , name = test_itinerary ["name" ], location = test_itinerary ["location" ], description = test_itinerary ["description" ], start_date = test_itinerary ["start_date" ], end_date = test_itinerary ["end_date" ], flights = test_itinerary ["flights" ], attractions = test_itinerary ["attractions" ])
123+
124+ same_name_result = add_itinerary (self .itineraries , name = test_itinerary ["name" ], location = "Another location" , description = "Another description" , start_date = test_itinerary ["start_date" ], end_date = test_itinerary ["end_date" ], flights = test_itinerary ["flights" ], attractions = test_itinerary ["attractions" ])
125+
126+ duplicate_result = add_itinerary (self .itineraries , name = test_itinerary ["name" ], location = test_itinerary ["location" ], description = test_itinerary ["description" ], start_date = test_itinerary ["start_date" ], end_date = test_itinerary ["end_date" ], flights = test_itinerary ["flights" ], attractions = test_itinerary ["attractions" ])
127+
128+ self .assertFalse (same_name_result )
129+ self .assertFalse (duplicate_result )
125130
126131 def test_add_invalid_itinerary (self ):
127132 """
0 commit comments