def convert_input(self, in_data: typing.Dict, **kwargs) -> typing.Dict: in_data["wheelchair_accessible"] = schema_utils.numbered_type_enum_key( in_data["wheelchair_accessible"], default_0=True) in_data["trip_route_type"] = schema_utils.numbered_type_enum_key( in_data["trip_route_type"]) in_data["bikes_allowed"] = schema_utils.numbered_type_enum_key( in_data["bikes_allowed"], default_0=True) return {k: v for k, v in in_data.items() if v}
def convert_input(self, in_data: typing.Dict, **kwargs) -> typing.Dict: in_data["arrival_time"] = schema_utils.time_as_seconds( in_data["arrival_time"]) in_data["departure_time"] = schema_utils.time_as_seconds( in_data["departure_time"]) in_data["pickup_type"] = schema_utils.numbered_type_enum_key( in_data["pickup_type"], default_0=True) in_data["drop_off_type"] = schema_utils.numbered_type_enum_key( in_data["drop_off_type"], default_0=True) return {k: v for k, v in in_data.items() if v}
def convert_input(self, in_data: typing.Dict, **kwargs) -> typing.Dict: in_data["location_type"] = schema_utils.numbered_type_enum_key( in_data["location_type"], default_0=True) in_data["wheelchair_boarding"] = schema_utils.numbered_type_enum_key( in_data["wheelchair_boarding"], default_0=True) in_data["vehicle_type"] = schema_utils.numbered_type_enum_key( in_data["vehicle_type"]) in_data["stop_timezone"] = schema_utils.timezone_enum_key( in_data.get("stop_timezone")) return {k: v for k, v in in_data.items() if v}
def convert_input(self, in_data: typing.Dict, **kwargs) -> typing.Dict: in_data["route_type"] = schema_utils.numbered_type_enum_key( in_data["route_type"]) for key in ("route_desc", "route_fare_class"): in_data[key] = in_data[key].replace(" ", "_").lower() return {k: v for k, v in in_data.items() if v}
def convert_input(self, in_data: typing.Dict, **kwargs) -> typing.Dict: in_data["service_schedule_type"] = in_data[ "service_schedule_type"].lower() in_data[ "service_schedule_typicality"] = schema_utils.numbered_type_enum_key( in_data["service_schedule_typicality"], default_0=True) return {k: v for k, v in in_data.items() if v}
def convert_input(self, in_data: typing.Dict, **kwargs) -> typing.Dict: in_data["test_type"] = schema_utils.numbered_type_enum_key( in_data["test_type"]) return {k: v for k, v in in_data.items() if v}
def test_numbered_type_enum_key_with_default(raw_value: Optional[str], updated_value: str): assert (schema_utils.numbered_type_enum_key( raw_value, default_0=True) == updated_value)
def test_numbered_type_enum_key_no_default(raw_value: Optional[str], updated_value: Optional[str]): assert schema_utils.numbered_type_enum_key(raw_value) == updated_value
def test_numbered_type_enum_key_bad_value(raw_value): with pytest.raises(mm.ValidationError): schema_utils.numbered_type_enum_key(raw_value)