class TestBusStop(unittest.TestCase): def setUp(self): self.bus_stop = BusStop("Waverly Station") self.person = Person("Guido van Rossum", 64) # @unittest.skip("Delete this line to run the test") def test_bus_stop_has_name(self): self.assertEqual("Waverly Station", self.bus_stop.name) # @unittest.skip("Delete this line to run the test") def test_queue_starts_empty(self): self.assertEqual(0, self.bus_stop.queue_length()) # @unittest.skip("Delete this line to run the test") def test_can_add_person_to_queue(self): self.bus_stop.add_to_queue(self.person) self.assertEqual(1, self.bus_stop.queue_length()) # @unittest.skip("Delete this line to run the test") def test_can_clear_queue(self): self.bus_stop.add_to_queue(self.person) self.bus_stop.clear() self.assertEqual(0, self.bus_stop.queue_length())
def test_can_pick_up_passenger_from_bus_stop(self): person_1 = Person("Guido van Rossum", 64) person_2 = Person("Carol Willing", 50) bus_stop = BusStop("Waverly Station") bus_stop.add_to_queue(person_1) bus_stop.add_to_queue(person_2) self.bus.pick_up_from_stop(bus_stop) self.assertEqual(2, self.bus.passenger_count()) self.assertEqual(0, bus_stop.queue_length())