Skip to content

Commit

Permalink
GH-170: Standardise casing for output type repr
Browse files Browse the repository at this point in the history
  • Loading branch information
markhobson committed Nov 21, 2024
1 parent 95a32ee commit e283478
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 44 deletions.
40 changes: 20 additions & 20 deletions schemes/views/schemes/outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,26 +148,26 @@ def to_domain(self) -> OutputRevision:

@unique
class OutputTypeRepr(Enum):
NEW_SEGREGATED_CYCLING_FACILITY = "New segregated cycling facility"
NEW_TEMPORARY_SEGREGATED_CYCLING_FACILITY = "New temporary segregated cycling facility"
NEW_JUNCTION_TREATMENT = "New junction treatment"
NEW_PERMANENT_FOOTWAY = "New permanent footway"
NEW_TEMPORARY_FOOTWAY = "New temporary footway"
NEW_SHARED_USE_FACILITIES = "New shared use (walking and cycling) facilities"
NEW_SHARED_USE_FACILITIES_WHEELING = "New shared use (walking, wheeling & cycling) facilities"
IMPROVEMENTS_TO_EXISTING_ROUTE = "Improvements to make an existing walking/cycle route safer"
AREA_WIDE_TRAFFIC_MANAGEMENT = "Area-wide traffic management (including by TROs (both permanent and experimental))"
BUS_PRIORITY_MEASURES = "Bus priority measures that also enable active travel (for example, bus gates)"
SECURE_CYCLE_PARKING = "Provision of secure cycle parking facilities"
NEW_ROAD_CROSSINGS = "New road crossings"
RESTRICTION_OR_REDUCTION_OF_CAR_PARKING_AVAILABILITY = "Restriction or reduction of car parking availability"
SCHOOL_STREETS = "School streets"
UPGRADES_TO_EXISTING_FACILITIES = "Upgrades to existing facilities (e.g. surfacing, signage, signals)"
E_SCOOTER_TRIALS = "E-scooter trials"
PARK_AND_CYCLE_STRIDE_FACILITIES = "Park and cycle/stride facilities"
TRAFFIC_CALMING = "Traffic calming (e.g. lane closures, reducing speed limits)"
WIDENING_EXISTING_FOOTWAY = "Widening existing footway"
OTHER_INTERVENTIONS = "Other interventions"
NEW_SEGREGATED_CYCLING_FACILITY = "new segregated cycling facility"
NEW_TEMPORARY_SEGREGATED_CYCLING_FACILITY = "new temporary segregated cycling facility"
NEW_JUNCTION_TREATMENT = "new junction treatment"
NEW_PERMANENT_FOOTWAY = "new permanent footway"
NEW_TEMPORARY_FOOTWAY = "new temporary footway"
NEW_SHARED_USE_FACILITIES = "new shared use (walking and cycling) facilities"
NEW_SHARED_USE_FACILITIES_WHEELING = "new shared use (walking, wheeling & cycling) facilities"
IMPROVEMENTS_TO_EXISTING_ROUTE = "improvements to make an existing walking/cycle route safer"
AREA_WIDE_TRAFFIC_MANAGEMENT = "area-wide traffic management (including by TROs (both permanent and experimental))"
BUS_PRIORITY_MEASURES = "bus priority measures that also enable active travel (for example, bus gates)"
SECURE_CYCLE_PARKING = "provision of secure cycle parking facilities"
NEW_ROAD_CROSSINGS = "new road crossings"
RESTRICTION_OR_REDUCTION_OF_CAR_PARKING_AVAILABILITY = "restriction or reduction of car parking availability"
SCHOOL_STREETS = "school streets"
UPGRADES_TO_EXISTING_FACILITIES = "upgrades to existing facilities (e.g. surfacing, signage, signals)"
E_SCOOTER_TRIALS = "e-scooter trials"
PARK_AND_CYCLE_STRIDE_FACILITIES = "park and cycle/stride facilities"
TRAFFIC_CALMING = "traffic calming (e.g. lane closures, reducing speed limits)"
WIDENING_EXISTING_FOOTWAY = "widening existing footway"
OTHER_INTERVENTIONS = "other interventions"

@classmethod
def from_domain(cls, type_: OutputType) -> OutputTypeRepr:
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/test_scheme_outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def test_scheme_outputs(app_client: AppClient, oidc_client: OidcClient, page: Pa
id=1,
effective_date_from="2020-01-01",
effective_date_to=None,
type="New segregated cycling facility",
type="new segregated cycling facility",
measure="miles",
value="3.000000",
observation_type="planned",
Expand All @@ -32,7 +32,7 @@ def test_scheme_outputs(app_client: AppClient, oidc_client: OidcClient, page: Pa
id=2,
effective_date_from="2020-01-01",
effective_date_to=None,
type="Improvements to make an existing walking/cycle route safer",
type="improvements to make an existing walking/cycle route safer",
measure="number of junctions",
value="2.600000",
observation_type="planned",
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_scheme.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ def test_get_scheme_output_revisions(self, schemes: SchemeRepository, client: Fl
"id": 2,
"effective_date_from": "2020-01-01T12:00:00",
"effective_date_to": None,
"type": "Improvements to make an existing walking/cycle route safer",
"type": "improvements to make an existing walking/cycle route safer",
"measure": "miles",
"value": "10",
"observation_type": "actual",
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_schemes.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ def test_add_schemes_output_revisions(self, schemes: SchemeRepository, client: F
"id": 2,
"effective_date_from": "2020-01-01T12:00:00",
"effective_date_to": None,
"type": "Improvements to make an existing walking/cycle route safer",
"type": "improvements to make an existing walking/cycle route safer",
"measure": "miles",
"value": "10",
"observation_type": "actual",
Expand Down
40 changes: 20 additions & 20 deletions tests/views/schemes/test_outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,38 +232,38 @@ def test_to_domain_when_no_effective_date_to(self) -> None:
@pytest.mark.parametrize(
"type_, type_repr",
[
(OutputType.NEW_SEGREGATED_CYCLING_FACILITY, "New segregated cycling facility"),
(OutputType.NEW_TEMPORARY_SEGREGATED_CYCLING_FACILITY, "New temporary segregated cycling facility"),
(OutputType.NEW_JUNCTION_TREATMENT, "New junction treatment"),
(OutputType.NEW_PERMANENT_FOOTWAY, "New permanent footway"),
(OutputType.NEW_TEMPORARY_FOOTWAY, "New temporary footway"),
(OutputType.NEW_SHARED_USE_FACILITIES, "New shared use (walking and cycling) facilities"),
(OutputType.NEW_SHARED_USE_FACILITIES_WHEELING, "New shared use (walking, wheeling & cycling) facilities"),
(OutputType.IMPROVEMENTS_TO_EXISTING_ROUTE, "Improvements to make an existing walking/cycle route safer"),
(OutputType.NEW_SEGREGATED_CYCLING_FACILITY, "new segregated cycling facility"),
(OutputType.NEW_TEMPORARY_SEGREGATED_CYCLING_FACILITY, "new temporary segregated cycling facility"),
(OutputType.NEW_JUNCTION_TREATMENT, "new junction treatment"),
(OutputType.NEW_PERMANENT_FOOTWAY, "new permanent footway"),
(OutputType.NEW_TEMPORARY_FOOTWAY, "new temporary footway"),
(OutputType.NEW_SHARED_USE_FACILITIES, "new shared use (walking and cycling) facilities"),
(OutputType.NEW_SHARED_USE_FACILITIES_WHEELING, "new shared use (walking, wheeling & cycling) facilities"),
(OutputType.IMPROVEMENTS_TO_EXISTING_ROUTE, "improvements to make an existing walking/cycle route safer"),
(
OutputType.AREA_WIDE_TRAFFIC_MANAGEMENT,
"Area-wide traffic management (including by TROs (both permanent and experimental))",
"area-wide traffic management (including by TROs (both permanent and experimental))",
),
(
OutputType.BUS_PRIORITY_MEASURES,
"Bus priority measures that also enable active travel (for example, bus gates)",
"bus priority measures that also enable active travel (for example, bus gates)",
),
(OutputType.SECURE_CYCLE_PARKING, "Provision of secure cycle parking facilities"),
(OutputType.NEW_ROAD_CROSSINGS, "New road crossings"),
(OutputType.SECURE_CYCLE_PARKING, "provision of secure cycle parking facilities"),
(OutputType.NEW_ROAD_CROSSINGS, "new road crossings"),
(
OutputType.RESTRICTION_OR_REDUCTION_OF_CAR_PARKING_AVAILABILITY,
"Restriction or reduction of car parking availability",
"restriction or reduction of car parking availability",
),
(OutputType.SCHOOL_STREETS, "School streets"),
(OutputType.SCHOOL_STREETS, "school streets"),
(
OutputType.UPGRADES_TO_EXISTING_FACILITIES,
"Upgrades to existing facilities (e.g. surfacing, signage, signals)",
"upgrades to existing facilities (e.g. surfacing, signage, signals)",
),
(OutputType.E_SCOOTER_TRIALS, "E-scooter trials"),
(OutputType.PARK_AND_CYCLE_STRIDE_FACILITIES, "Park and cycle/stride facilities"),
(OutputType.TRAFFIC_CALMING, "Traffic calming (e.g. lane closures, reducing speed limits)"),
(OutputType.WIDENING_EXISTING_FOOTWAY, "Widening existing footway"),
(OutputType.OTHER_INTERVENTIONS, "Other interventions"),
(OutputType.E_SCOOTER_TRIALS, "e-scooter trials"),
(OutputType.PARK_AND_CYCLE_STRIDE_FACILITIES, "park and cycle/stride facilities"),
(OutputType.TRAFFIC_CALMING, "traffic calming (e.g. lane closures, reducing speed limits)"),
(OutputType.WIDENING_EXISTING_FOOTWAY, "widening existing footway"),
(OutputType.OTHER_INTERVENTIONS, "other interventions"),
],
)
class TestOutputTypeRepr:
Expand Down

0 comments on commit e283478

Please sign in to comment.