Example #1
0
    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")
Example #2
0
    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")
Example #3
0
    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")
Example #4
0
    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")