From 8b65bf1946e61da735a0a55e3a43b268d73300c2 Mon Sep 17 00:00:00 2001 From: Youness CHRIFI ALAOUI Date: Fri, 22 Nov 2024 00:37:43 +0100 Subject: [PATCH] fixup! tests: update railjson version --- front/src/reducers/osrdconf/infra_schema.json | 13 ++++++-- front/tests/assets/infra/infra.json | 32 ++++++++++++------- python/osrd_schemas/osrd_schemas/infra.py | 2 +- .../railjson_generator/schema/infra/infra.py | 1 + .../schema/infra/operational_point.py | 2 ++ tests/data/infras/example_script/infra.json | 3 +- .../data/infras/overlapping_routes/infra.json | 3 +- tests/data/infras/small_infra/infra.json | 24 +++++++++----- tests/data/infras/tiny_infra/infra.json | 6 ++-- 9 files changed, 59 insertions(+), 27 deletions(-) diff --git a/front/src/reducers/osrdconf/infra_schema.json b/front/src/reducers/osrdconf/infra_schema.json index c88c204b44b..2d646ba5e57 100644 --- a/front/src/reducers/osrdconf/infra_schema.json +++ b/front/src/reducers/osrdconf/infra_schema.json @@ -842,11 +842,18 @@ "type": "array" }, "weight": { + "anyOf": [ + { + "minimum": 0, + "type": "integer" + }, + { + "type": "null" + } + ], "default": null, "description": "represents the significance of a PR", - "minimum": 0, - "title": "Weight", - "type": "integer" + "title": "Weight" } }, "required": [ diff --git a/front/tests/assets/infra/infra.json b/front/tests/assets/infra/infra.json index e52b1b5ce6e..8d7fb1ce9ff 100644 --- a/front/tests/assets/infra/infra.json +++ b/front/tests/assets/infra/infra.json @@ -1,5 +1,5 @@ { - "version": "3.4.12", + "version": "3.4.13", "track_sections": [ { "id": "TA1", @@ -6757,7 +6757,8 @@ "uic": 4, "name": "Mid_East_station" } - } + }, + "weight": null }, { "id": "Mid_West_station", @@ -6803,7 +6804,8 @@ "uic": 3, "name": "Mid_West_station" } - } + }, + "weight": null }, { "id": "North_East_station", @@ -6835,7 +6837,8 @@ "uic": 7, "name": "North_East_station" } - } + }, + "weight": null }, { "id": "North_West_station", @@ -6860,7 +6863,8 @@ "uic": 123456, "name": "North_West_station" } - } + }, + "weight": null }, { "id": "North_West_station_1", @@ -6885,7 +6889,8 @@ "uic": 123456, "name": "North_West_station" } - } + }, + "weight": null }, { "id": "North_station", @@ -6917,7 +6922,8 @@ "uic": 5, "name": "North_station" } - } + }, + "weight": null }, { "id": "South_East_station", @@ -6942,7 +6948,8 @@ "uic": 8, "name": "South_East_station" } - } + }, + "weight": null }, { "id": "South_West_station", @@ -6967,7 +6974,8 @@ "uic": 1, "name": "South_West_station" } - } + }, + "weight": null }, { "id": "South_station", @@ -6992,7 +7000,8 @@ "uic": 6, "name": "South_station" } - } + }, + "weight": null }, { "id": "West_station", @@ -7031,7 +7040,8 @@ "uic": 2, "name": "West_station" } - } + }, + "weight": null } ], "electrifications": [ diff --git a/python/osrd_schemas/osrd_schemas/infra.py b/python/osrd_schemas/osrd_schemas/infra.py index cef8cb64bcb..376c8e3830b 100755 --- a/python/osrd_schemas/osrd_schemas/infra.py +++ b/python/osrd_schemas/osrd_schemas/infra.py @@ -197,7 +197,7 @@ class OperationalPoint(BaseObjectTrait): """ parts: List[OperationalPointPart] - weight: int = Field(description="represents the significance of a PR", ge=0, default=None) + weight: Optional[int] = Field(description="represents the significance of a PR", ge=0, default=None) class TrackEndpoint(BaseModel): diff --git a/python/railjson_generator/railjson_generator/schema/infra/infra.py b/python/railjson_generator/railjson_generator/schema/infra/infra.py index 0df3b1c215c..f1f47461868 100644 --- a/python/railjson_generator/railjson_generator/schema/infra/infra.py +++ b/python/railjson_generator/railjson_generator/schema/infra/infra.py @@ -88,6 +88,7 @@ def make_rjs_operational_points(self): ), "identifier": infra.OperationalPointIdentifierExtension(uic=op.uic, name=op.label), }, + weight=None, ) ops.append(new_op) return ops diff --git a/python/railjson_generator/railjson_generator/schema/infra/operational_point.py b/python/railjson_generator/railjson_generator/schema/infra/operational_point.py index c4049651b6b..012335c0bd8 100644 --- a/python/railjson_generator/railjson_generator/schema/infra/operational_point.py +++ b/python/railjson_generator/railjson_generator/schema/infra/operational_point.py @@ -9,6 +9,7 @@ class OperationalPoint: label: str trigram: str parts: List + weight: int uic: int def __init__(self, label: str, trigram: Optional[str] = None, uic: int = 0): @@ -16,6 +17,7 @@ def __init__(self, label: str, trigram: Optional[str] = None, uic: int = 0): self.trigram = trigram or label[:3].upper() self.parts = list() self.uic = uic + self.weight = None def add_part(self, track, offset): op_part = OperationalPointPart(self, offset) diff --git a/tests/data/infras/example_script/infra.json b/tests/data/infras/example_script/infra.json index b6f35f4c471..8b16144c12e 100644 --- a/tests/data/infras/example_script/infra.json +++ b/tests/data/infras/example_script/infra.json @@ -25,7 +25,8 @@ "name": "my-op", "uic": 0 } - } + }, + "weight": null } ], "routes": [ diff --git a/tests/data/infras/overlapping_routes/infra.json b/tests/data/infras/overlapping_routes/infra.json index 770e27e567c..aa00cafb446 100644 --- a/tests/data/infras/overlapping_routes/infra.json +++ b/tests/data/infras/overlapping_routes/infra.json @@ -21,7 +21,8 @@ "name": "op.a1", "uic": 0 } - } + }, + "weight": null }, { "id": "op.a2", diff --git a/tests/data/infras/small_infra/infra.json b/tests/data/infras/small_infra/infra.json index 35a284e9e5c..9b653d318a3 100644 --- a/tests/data/infras/small_infra/infra.json +++ b/tests/data/infras/small_infra/infra.json @@ -29,7 +29,8 @@ "name": "West_station", "uic": 2 } - } + }, + "weight": null }, { "id": "South_West_station", @@ -51,7 +52,8 @@ "name": "South_West_station", "uic": 1 } - } + }, + "weight": null }, { "id": "Mid_West_station", @@ -85,7 +87,8 @@ "name": "Mid_West_station", "uic": 3 } - } + }, + "weight": null }, { "id": "Mid_East_station", @@ -111,7 +114,8 @@ "name": "Mid_East_station", "uic": 4 } - } + }, + "weight": null }, { "id": "North_station", @@ -137,7 +141,8 @@ "name": "North_station", "uic": 5 } - } + }, + "weight": null }, { "id": "South_station", @@ -159,7 +164,8 @@ "name": "South_station", "uic": 6 } - } + }, + "weight": null }, { "id": "North_East_station", @@ -185,7 +191,8 @@ "name": "North_East_station", "uic": 7 } - } + }, + "weight": null }, { "id": "South_East_station", @@ -207,7 +214,8 @@ "name": "South_East_station", "uic": 8 } - } + }, + "weight": null } ], "routes": [ diff --git a/tests/data/infras/tiny_infra/infra.json b/tests/data/infras/tiny_infra/infra.json index 33a0ee36a4a..941740ca470 100644 --- a/tests/data/infras/tiny_infra/infra.json +++ b/tests/data/infras/tiny_infra/infra.json @@ -25,7 +25,8 @@ "name": "op.station_foo", "uic": 0 } - } + }, + "weight": null }, { "id": "op.station_bar", @@ -47,7 +48,8 @@ "name": "op.station_bar", "uic": 0 } - } + }, + "weight": null } ], "routes": [