Skip to content

Commit

Permalink
fixup! tests: update railjson version
Browse files Browse the repository at this point in the history
  • Loading branch information
younesschrifi committed Nov 21, 2024
1 parent 33b53f9 commit 8b65bf1
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 27 deletions.
13 changes: 10 additions & 3 deletions front/src/reducers/osrdconf/infra_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down
32 changes: 21 additions & 11 deletions front/tests/assets/infra/infra.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "3.4.12",
"version": "3.4.13",
"track_sections": [
{
"id": "TA1",
Expand Down Expand Up @@ -6757,7 +6757,8 @@
"uic": 4,
"name": "Mid_East_station"
}
}
},
"weight": null
},
{
"id": "Mid_West_station",
Expand Down Expand Up @@ -6803,7 +6804,8 @@
"uic": 3,
"name": "Mid_West_station"
}
}
},
"weight": null
},
{
"id": "North_East_station",
Expand Down Expand Up @@ -6835,7 +6837,8 @@
"uic": 7,
"name": "North_East_station"
}
}
},
"weight": null
},
{
"id": "North_West_station",
Expand All @@ -6860,7 +6863,8 @@
"uic": 123456,
"name": "North_West_station"
}
}
},
"weight": null
},
{
"id": "North_West_station_1",
Expand All @@ -6885,7 +6889,8 @@
"uic": 123456,
"name": "North_West_station"
}
}
},
"weight": null
},
{
"id": "North_station",
Expand Down Expand Up @@ -6917,7 +6922,8 @@
"uic": 5,
"name": "North_station"
}
}
},
"weight": null
},
{
"id": "South_East_station",
Expand All @@ -6942,7 +6948,8 @@
"uic": 8,
"name": "South_East_station"
}
}
},
"weight": null
},
{
"id": "South_West_station",
Expand All @@ -6967,7 +6974,8 @@
"uic": 1,
"name": "South_West_station"
}
}
},
"weight": null
},
{
"id": "South_station",
Expand All @@ -6992,7 +7000,8 @@
"uic": 6,
"name": "South_station"
}
}
},
"weight": null
},
{
"id": "West_station",
Expand Down Expand Up @@ -7031,7 +7040,8 @@
"uic": 2,
"name": "West_station"
}
}
},
"weight": null
}
],
"electrifications": [
Expand Down
2 changes: 1 addition & 1 deletion python/osrd_schemas/osrd_schemas/infra.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ class OperationalPoint:
label: str
trigram: str
parts: List
weight: int
uic: int

def __init__(self, label: str, trigram: Optional[str] = None, uic: int = 0):
self.label = label
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)
Expand Down
3 changes: 2 additions & 1 deletion tests/data/infras/example_script/infra.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"name": "my-op",
"uic": 0
}
}
},
"weight": null
}
],
"routes": [
Expand Down
3 changes: 2 additions & 1 deletion tests/data/infras/overlapping_routes/infra.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"name": "op.a1",
"uic": 0
}
}
},
"weight": null
},
{
"id": "op.a2",
Expand Down
24 changes: 16 additions & 8 deletions tests/data/infras/small_infra/infra.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
"name": "West_station",
"uic": 2
}
}
},
"weight": null
},
{
"id": "South_West_station",
Expand All @@ -51,7 +52,8 @@
"name": "South_West_station",
"uic": 1
}
}
},
"weight": null
},
{
"id": "Mid_West_station",
Expand Down Expand Up @@ -85,7 +87,8 @@
"name": "Mid_West_station",
"uic": 3
}
}
},
"weight": null
},
{
"id": "Mid_East_station",
Expand All @@ -111,7 +114,8 @@
"name": "Mid_East_station",
"uic": 4
}
}
},
"weight": null
},
{
"id": "North_station",
Expand All @@ -137,7 +141,8 @@
"name": "North_station",
"uic": 5
}
}
},
"weight": null
},
{
"id": "South_station",
Expand All @@ -159,7 +164,8 @@
"name": "South_station",
"uic": 6
}
}
},
"weight": null
},
{
"id": "North_East_station",
Expand All @@ -185,7 +191,8 @@
"name": "North_East_station",
"uic": 7
}
}
},
"weight": null
},
{
"id": "South_East_station",
Expand All @@ -207,7 +214,8 @@
"name": "South_East_station",
"uic": 8
}
}
},
"weight": null
}
],
"routes": [
Expand Down
6 changes: 4 additions & 2 deletions tests/data/infras/tiny_infra/infra.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"name": "op.station_foo",
"uic": 0
}
}
},
"weight": null
},
{
"id": "op.station_bar",
Expand All @@ -47,7 +48,8 @@
"name": "op.station_bar",
"uic": 0
}
}
},
"weight": null
}
],
"routes": [
Expand Down

0 comments on commit 8b65bf1

Please sign in to comment.