Skip to content

Commit

Permalink
tests: update railjson version
Browse files Browse the repository at this point in the history
Signed-off-by: Youness CHRIFI ALAOUI <[email protected]>
  • Loading branch information
younesschrifi committed Dec 6, 2024
1 parent 8efefb2 commit 0c4441d
Show file tree
Hide file tree
Showing 13 changed files with 41 additions and 15 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
5 changes: 3 additions & 2 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 @@ -6803,7 +6803,8 @@
"uic": 3,
"name": "Mid_West_station"
}
}
},

},
{
"id": "North_East_station",
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: Optional[int]
uic: int

def __init__(self, label: str, trigram: Optional[str] = None, uic: int = 0):
def __init__(self, label: str, trigram: Optional[str] = None, uic: int = 0, weight: Optional[int] = None):
self.label = label
self.trigram = trigram or label[:3].upper()
self.parts = list()
self.uic = uic
self.weight = weight

def add_part(self, track, offset):
op_part = OperationalPointPart(self, offset)
Expand Down
2 changes: 1 addition & 1 deletion tests/data/infras/circle_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",
"operational_points": [],
"routes": [],
"extended_switch_types": [],
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
@@ -1,5 +1,5 @@
{
"version": "3.4.12",
"version": "3.4.13",
"operational_points": [
{
"id": "my-op",
Expand All @@ -13,6 +13,7 @@
"position": 500.0
}
],
"weight": null,
"extensions": {
"sncf": {
"ci": 0,
Expand Down
2 changes: 1 addition & 1 deletion tests/data/infras/nested_switches/infra.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "3.4.12",
"version": "3.4.13",
"operational_points": [],
"routes": [
{
Expand Down
2 changes: 1 addition & 1 deletion tests/data/infras/one_line/infra.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "3.4.12",
"version": "3.4.13",
"operational_points": [],
"routes": [
{
Expand Down
6 changes: 5 additions & 1 deletion tests/data/infras/overlapping_routes/infra.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "3.4.12",
"version": "3.4.13",
"operational_points": [
{
"id": "op.a1",
Expand All @@ -9,6 +9,7 @@
"position": 0.0
}
],
"weight": null,
"extensions": {
"sncf": {
"ci": 0,
Expand All @@ -31,6 +32,7 @@
"position": 1000.0
}
],
"weight": null,
"extensions": {
"sncf": {
"ci": 0,
Expand All @@ -53,6 +55,7 @@
"position": 0.0
}
],
"weight": null,
"extensions": {
"sncf": {
"ci": 0,
Expand All @@ -75,6 +78,7 @@
"position": 1000.0
}
],
"weight": null,
"extensions": {
"sncf": {
"ci": 0,
Expand Down
10 changes: 9 additions & 1 deletion tests/data/infras/small_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",
"operational_points": [
{
"id": "West_station",
Expand All @@ -17,6 +17,7 @@
"position": 500.0
}
],
"weight": null,
"extensions": {
"sncf": {
"ci": 0,
Expand All @@ -39,6 +40,7 @@
"position": 500.0
}
],
"weight": null,
"extensions": {
"sncf": {
"ci": 0,
Expand Down Expand Up @@ -73,6 +75,7 @@
"position": 450.0
}
],
"weight": null,
"extensions": {
"sncf": {
"ci": 0,
Expand All @@ -99,6 +102,7 @@
"position": 14000.0
}
],
"weight": null,
"extensions": {
"sncf": {
"ci": 0,
Expand All @@ -125,6 +129,7 @@
"position": 1025.0
}
],
"weight": null,
"extensions": {
"sncf": {
"ci": 0,
Expand All @@ -147,6 +152,7 @@
"position": 4300.0
}
],
"weight": null,
"extensions": {
"sncf": {
"ci": 0,
Expand All @@ -173,6 +179,7 @@
"position": 1500.0
}
],
"weight": null,
"extensions": {
"sncf": {
"ci": 0,
Expand All @@ -195,6 +202,7 @@
"position": 4400.0
}
],
"weight": null,
"extensions": {
"sncf": {
"ci": 0,
Expand Down
2 changes: 1 addition & 1 deletion tests/data/infras/three_trains/infra.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "3.4.12",
"version": "3.4.13",
"operational_points": [],
"routes": [
{
Expand Down
4 changes: 3 additions & 1 deletion tests/data/infras/tiny_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",
"operational_points": [
{
"id": "op.station_foo",
Expand All @@ -13,6 +13,7 @@
"position": 100.0
}
],
"weight": null,
"extensions": {
"sncf": {
"ci": 0,
Expand All @@ -35,6 +36,7 @@
"position": 100.0
}
],
"weight": null,
"extensions": {
"sncf": {
"ci": 0,
Expand Down

0 comments on commit 0c4441d

Please sign in to comment.