def route(self, onestop_id): """Return a single route by Onestop ID.""" return util.filtfirst(self.routes(), onestop=onestop_id)
def test_filtfirst_empty(self): with self.assertRaises(ValueError): util.filtfirst(self.testdata, name='Asdf') with self.assertRaises(ValueError): util.filtfirst(self.testdata, id='0')
def operator(self, onestop_id): """Return a single operator by Onestop ID.""" return util.filtfirst(self.operators(), onestop=onestop_id)
def test_filtfirst_name(self): data = util.filtfirst(self.testdata, name='Foo') assert data.name() == 'Foo'
def test_filtfirst_id(self): data = util.filtfirst(self.testdata, id='1') assert data.id() == '1'
def stop(self, key): """Return a single stop by ID.""" return util.filtfirst(self.stops(), id=key)
def route(self, key): """Return a single route by ID.""" return util.filtfirst(self.routes(), id=key)
def stop(self, onestop_id): """Return a single stop by Onestop ID.""" return util.filtfirst(self.stops(), onestop=onestop_id)
def trip(self, key): """Return a single trip by ID.""" return util.filtfirst(self.trips(), id=key)