def test_maximum_properties(self): td = create_full_transit_data() fare_rule = td.fare_rules.add(**FULL_FARE_RULE_CSV_ROW) test_property(self, fare_rule, property_name="fare", new_value=td.fare_attributes["2"]) test_property(self, fare_rule, property_name="route", new_value=td.routes["1002"]) test_property(self, fare_rule, property_name="origin_id", new_value=2) test_property(self, fare_rule, property_name="destination_id", new_value=1) test_property(self, fare_rule, property_name="contains_id", new_value=1) self.assertIn("test_attribute", fare_rule.attributes) test_attribute(self, fare_rule, attribute_name="test_attribute", new_value="new test data")
def test_maximum_properties(self): td = TransitData() shape_point = None for row in FULL_SHAPE_CSV_ROWS: shape_point = td.shapes.add(**row) shape = iter(td.shapes).next() self.assertTrue(hasattr(shape, "id")) self.assertRaises(Exception, setattr, shape, "id", "2") test_property(self, shape_point, property_name="latitude", new_value=0) test_property(self, shape_point, property_name="longitude", new_value=0) test_property(self, shape_point, property_name="sequence", new_value=2) test_property(self, shape_point, property_name="shape_dist_traveled", new_value=60.2) self.assertIn("test_attribute", shape_point.attributes) shape_point.attributes["test_attribute"] = "new test data" self.assertEqual(shape_point.attributes["test_attribute"], "new test data") self.assertNotIn("test_attribute2", shape_point.attributes) shape_point.attributes["test_attribute2"] = "more test data" self.assertEqual(shape_point.attributes["test_attribute2"], "more test data")
def test_minimum_properties(self): td = TransitData() shape_point = None for row in MINI_SHAPE_CSV_ROWS: shape_point = td.shapes.add(**row) shape = iter(td.shapes).next() self.assertTrue(hasattr(shape, "id")) self.assertRaises(Exception, setattr, shape, "id", "2") test_property(self, shape_point, property_name="latitude", new_value=0) test_property(self, shape_point, property_name="longitude", new_value=0) test_property(self, shape_point, property_name="sequence", new_value=2) test_property(self, shape_point, property_name="shape_dist_traveled", new_value=60.2)
def test_maximum_properties(self): td = TransitData() stop = None for row in FULL_STOP_CSV_ROWS: stop = td.stops.add(**row) self.assertTrue(hasattr(stop, "id")) self.assertRaises(Exception, setattr, stop, "id", "2") test_property(self, stop, property_name="stop_name", new_value="test name") test_property(self, stop, property_name="stop_lat", new_value=0) test_property(self, stop, property_name="stop_lon", new_value=0) test_property(self, stop, property_name="stop_code", new_value="1") test_property(self, stop, property_name="stop_desc", new_value="test desc") test_property(self, stop, property_name="zone_id", new_value=2) test_property(self, stop, property_name="stop_url", new_value="http://testurl.com/") test_property(self, stop, property_name="location_type", new_value=1) test_property(self, stop, property_name="parent_station", new_value=stop) test_property(self, stop, property_name="stop_timezone", new_value="Asia/Hebron") test_property(self, stop, property_name="wheelchair_boarding", new_value=False) self.assertIn("test_attribute", stop.attributes) stop.attributes["test_attribute"] = "new test data" self.assertEqual(stop.attributes["test_attribute"], "new test data") self.assertNotIn("test_attribute2", stop.attributes) stop.attributes["test_attribute2"] = "more test data" self.assertEqual(stop.attributes["test_attribute2"], "more test data")
def test_minimum_properties(self): td = TransitData() stop = None for row in MINI_STOP_CSV_ROWS: stop = td.stops.add(**row) self.assertTrue(hasattr(stop, "id")) self.assertRaises(Exception, setattr, stop, "id", 2) test_property(self, stop, property_name="stop_name", new_value="test name") test_property(self, stop, property_name="stop_lat", new_value=0) test_property(self, stop, property_name="stop_lon", new_value=0) test_property(self, stop, property_name="stop_code", new_value="1") test_property(self, stop, property_name="stop_desc", new_value="test desc") test_property(self, stop, property_name="zone_id", new_value=2) test_property(self, stop, property_name="stop_url", new_value="http://testurl.com/") test_property(self, stop, property_name="location_type", new_value=1) test_property(self, stop, property_name="parent_station", new_value=stop) test_property(self, stop, property_name="stop_timezone", new_value="Asia/Hebron") test_property(self, stop, property_name="wheelchair_boarding", new_value=True)
def test_maximum_properties(self): td = TransitData() agency = td.agencies.add(**FULL_AGENCY_CSV_ROW) self.assertTrue(hasattr(agency, "id")) self.assertRaises(Exception, setattr, agency, "id", 2) test_property(self, agency, property_name="agency_name", new_value="test name") test_property(self, agency, property_name="agency_url", new_value="http://testurl.com/") test_property(self, agency, property_name="agency_timezone", new_value="Asia/Hebron") test_property(self, agency, property_name="agency_lang", new_value="EN") test_property(self, agency, property_name="agency_phone", new_value="*1234") test_property(self, agency, property_name="agency_email", new_value="*****@*****.**") test_property(self, agency, property_name="agency_fare_url", new_value="http://testurl.com/fare/") self.assertIn("test_attribute", agency.attributes) agency.attributes["test_attribute"] = "new test data" self.assertEqual(agency.attributes["test_attribute"], "new test data") self.assertNotIn("test_attribute2", agency.attributes) agency.attributes["test_attribute2"] = "more test data" self.assertEqual(agency.attributes["test_attribute2"], "more test data")
def test_minimum_properties(self): td = TransitData() agency = td.agencies.add(**MINI_AGENCY_CSV_ROW) self.assertTrue(hasattr(agency, "id")) self.assertRaises(Exception, setattr, agency, "id", 2) test_property(self, agency, property_name="agency_name", new_value="test name") test_property(self, agency, property_name="agency_url", new_value="http://testurl.com/") test_property(self, agency, property_name="agency_timezone", new_value="Asia/Hebron") test_property(self, agency, property_name="agency_lang", new_value="HE") test_property(self, agency, property_name="agency_phone", new_value="*1234") test_property(self, agency, property_name="agency_email", new_value="*****@*****.**") test_property(self, agency, property_name="agency_fare_url", new_value="http://testurl.com/fare/")
def test_maximum_properties(self): td = create_full_transit_data() stop_time = td.add_stop_time(**FULL_STOP_TIME_CSV_ROW) test_property(self, stop_time, property_name="trip", new_value=td.trips["1001_2"]) test_property(self, stop_time, property_name="arrival_time", new_value=timedelta(hours=2)) test_property(self, stop_time, property_name="departure_time", new_value=timedelta(hours=3)) test_property(self, stop_time, property_name="stop", new_value=td.stops[20000]) test_property(self, stop_time, property_name="stop_sequence", new_value=1) test_property(self, stop_time, property_name="pickup_type", new_value=2) test_property(self, stop_time, property_name="drop_off_type", new_value=2) test_property(self, stop_time, property_name="allow_pickup", new_value=False) test_property(self, stop_time, property_name="allow_drop_off", new_value=False) test_property(self, stop_time, property_name="shape_dist_traveled", new_value=1) test_property(self, stop_time, property_name="stop_headsign", new_value="new headsign") test_property(self, stop_time, property_name="is_exact_time", new_value=not stop_time.is_exact_time) self.assertIn("test_attribute", stop_time.attributes) test_attribute(self, stop_time, attribute_name="test_attribute", new_value="new test data")
def test_maximum_properties(self): td = create_full_transit_data() trip = td.trips.add(**FULL_TRIP_CSV_ROW) self.assertTrue(hasattr(trip, "id")) self.assertRaises(Exception, setattr, trip, "id", "2") test_property(self, trip, property_name="route", new_value=td.routes['1002']) test_property(self, trip, property_name="service", new_value=td.calendar['2']) test_property(self, trip, property_name="trip_headsign", new_value="new headsign") test_property(self, trip, property_name="trip_short_name", new_value="2") test_property(self, trip, property_name="direction_id", new_value="2") test_property(self, trip, property_name="block_id", new_value='2') test_property(self, trip, property_name="shape", new_value=td.shapes['2']) test_property(self, trip, property_name="bikes_allowed", new_value=False) test_property(self, trip, property_name="wheelchair_accessible", new_value=True) test_property(self, trip, property_name="original_trip_id", new_value="2 origin") self.assertIn("test_attribute", trip.attributes) test_attribute(self, trip, attribute_name="test_attribute", new_value="new test data")
def test_maximum_properties(self): td = create_full_transit_data() fare_attribute = td.fare_attributes.add(**FULL_FARE_ATTRIBUTE_CSV_ROW) self.assertTrue(hasattr(fare_attribute, "id")) self.assertRaises(Exception, setattr, fare_attribute, "id", "2") test_property(self, fare_attribute, property_name="price", new_value=1) test_property(self, fare_attribute, property_name="currency_type", new_value="USD") test_property(self, fare_attribute, property_name="payment_method", new_value=1) test_property(self, fare_attribute, property_name="is_prepaid_needed", new_value=not fare_attribute.is_prepaid_needed) test_property(self, fare_attribute, property_name="transfers", new_value=1) test_property(self, fare_attribute, property_name="agency", new_value=td.agencies[15]) test_property(self, fare_attribute, property_name="transfer_duration", new_value=2) self.assertIn("test_attribute", fare_attribute.attributes) fare_attribute.attributes["test_attribute"] = "new test data" self.assertEqual(fare_attribute.attributes["test_attribute"], "new test data") self.assertNotIn("test_attribute2", fare_attribute.attributes) fare_attribute.attributes["test_attribute2"] = "more test data" self.assertEqual(fare_attribute.attributes["test_attribute2"], "more test data")
def test_minimum_properties(self): td = create_full_transit_data() fare_attribute = td.fare_attributes.add(**MINI_FARE_ATTRIBUTE_CSV_ROW) self.assertTrue(hasattr(fare_attribute, "id")) self.assertRaises(Exception, setattr, fare_attribute, "id", "2") test_property(self, fare_attribute, property_name="price", new_value=1) test_property(self, fare_attribute, property_name="currency_type", new_value="USD") test_property(self, fare_attribute, property_name="payment_method", new_value=1) test_property(self, fare_attribute, property_name="is_prepaid_needed", new_value=not fare_attribute.is_prepaid_needed) test_property(self, fare_attribute, property_name="transfers", new_value=1) test_property(self, fare_attribute, property_name="agency", new_value=td.agencies[15]) test_property(self, fare_attribute, property_name="transfer_duration", new_value=2)
def test_maximum_properties(self): td = create_full_transit_data() route = td.routes.add(**FULL_ROUTE_CSV_ROW) self.assertTrue(hasattr(route, "id")) self.assertRaises(Exception, setattr, route, "id", "2") test_property(self, route, property_name="route_short_name", new_value="2") test_property(self, route, property_name="route_long_name", new_value="new name") test_property(self, route, property_name="route_type", new_value=2) test_property(self, route, property_name="agency", new_value=td.agencies['15']) test_property(self, route, property_name="route_desc", new_value="new route desc") test_property(self, route, property_name="route_url", new_value="http://testurl.com/") test_property(self, route, property_name="route_color", new_value="FFFF00") test_property(self, route, property_name="route_text_color", new_value="0000FF") test_property(self, route, property_name="route_sort_order", new_value=2) self.assertIn("test_attribute", route.attributes) test_attribute(self, route, attribute_name="test_attribute", new_value="new test data")
def test_maximum_properties(self): td = TransitData() service = td.calendar.add(**FULL_SERVICE_CSV_ROW) self.assertTrue(hasattr(service, "id")) self.assertRaises(Exception, setattr, service, "id", "2") test_property(self, service, property_name="start_date", new_value=TOMORROW_DATE) test_property(self, service, property_name="end_date", new_value=TOMORROW_DATE + timedelta(days=1)) test_property(self, service, property_name="sunday", new_value=False) test_property(self, service, property_name="monday", new_value=False) test_property(self, service, property_name="tuesday", new_value=False) test_property(self, service, property_name="wednesday", new_value=False) test_property(self, service, property_name="thursday", new_value=False) test_property(self, service, property_name="friday", new_value=False) service.sunday = True test_property(self, service, property_name="saturday", new_value=False) self.assertIn("test_attribute", service.attributes) service.attributes["test_attribute"] = "new test data" self.assertEqual(service.attributes["test_attribute"], "new test data") self.assertNotIn("test_attribute2", service.attributes) service.attributes["test_attribute2"] = "more test data" self.assertEqual(service.attributes["test_attribute2"], "more test data")
def test_minimum_properties(self): td = TransitData() service = td.calendar.add(**MINI_SERVICE_CSV_ROW) self.assertTrue(hasattr(service, "id")) self.assertRaises(Exception, setattr, service, "id", "2") test_property(self, service, property_name="start_date", new_value=TOMORROW_DATE) test_property(self, service, property_name="end_date", new_value=TOMORROW_DATE) test_property(self, service, property_name="saturday", new_value=True) test_property(self, service, property_name="sunday", new_value=False) test_property(self, service, property_name="monday", new_value=True) test_property(self, service, property_name="tuesday", new_value=True) test_property(self, service, property_name="wednesday", new_value=True) test_property(self, service, property_name="thursday", new_value=True) test_property(self, service, property_name="friday", new_value=True)