def test_valid_service_names(self): """Valid service names don't throw exceptions """ try: for service_name in ['metro', 'ulsterbus', 'goldline', 'nir', 'enterprise']: Service(service_name) except InvalidServiceError: self.fail('InvalidServiceError raised unexpectedly')
def test_enterprise_route_count(self): """Test that the enterprise service returns the correct number of routes """ service = Service('enterprise') with self.assertRaises(NotImplementedError): service.routes()
def test_ulsterbus_route_count(self): """Test that the ulsterbus service returns the correct number of routes """ service = Service('ulsterbus') self.assertEqual(454, len(service.routes()))
def test_metro_route_count(self): """Test that the metro service returns the correct number of routes """ service = Service('metro') self.assertEqual(102, len(service.routes()))
def test_goldline_route_count(self): """Test that the goldline service returns the correct number of routes """ service = Service('goldline') self.assertEqual(34, len(service.routes()))
def test_invalid_service_names(self): """Invalid service name throws exceptions """ with self.assertRaises(InvalidServiceError): Service('metrov')