Skip to content

Commit

Permalink
python: clarify tests (railjson_generator)
Browse files Browse the repository at this point in the history
  • Loading branch information
shenriotpro committed Jan 4, 2024
1 parent a69a9f9 commit 7cf0649
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 17 deletions.
18 changes: 11 additions & 7 deletions python/railjson_generator/railjson_generator/test_infra_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def test_add_point_switch(self):
ib = InfraBuilder()
assert ib.infra.switches == []
# x y
# =========\======
# =========o======
# \=====
# z
x = ib.add_track_section(length=1)
Expand All @@ -53,7 +53,7 @@ def test_add_crossing(self):
assert ib.infra.switches == []
# w y
# ========\ /=======
# X
# o
# ========/ \=======
# x z
w = ib.add_track_section(length=1)
Expand All @@ -77,9 +77,10 @@ def test_add_crossing(self):
def test_add_double_slip_switch(self):
ib = InfraBuilder()
assert ib.infra.switches == []
# Here, we can one can go ahead OR "turn".
# w y
# ==================
# X
# o
# ==================
# x z
w = ib.add_track_section(length=1)
Expand All @@ -104,7 +105,7 @@ def test_add_link(self):
ib = InfraBuilder()
assert ib.infra.switches == []
# x y
# =================
# ========o========
x = ib.add_track_section(length=1)
source = x.end()
y = ib.add_track_section(length=1)
Expand Down Expand Up @@ -159,8 +160,9 @@ def test_register_route(self):
def test_generate_routes(self):
ib = InfraBuilder()
assert ib.infra.routes == []
# Possible routes are x->y, x->z, and mirrors.
# x y
# ======d==\======
# ======d==o======
# \=====
# z
detector = Detector(position=0.5)
Expand Down Expand Up @@ -216,8 +218,9 @@ def test_generate_routes(self):
def test_generate_routes_without_release(self):
ib = InfraBuilder()
assert ib.infra.routes == []
# Possible routes are x->y, x->z, and mirrors.
# x y
# ======d==\======
# ======d==o======
# \=====
# z
detector = Detector(position=0.5)
Expand Down Expand Up @@ -280,8 +283,9 @@ def test_build_with_duplicates(self):

def test_build(self):
ib = InfraBuilder()
# Possible routes are x->y, x->z, and mirrors.
# x y
# ======d==\======
# ======d==o======
# \=====
# z
detector = Detector(position=0.5)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class TestZonePathStep:
def test_build(self):
ib = InfraBuilder()
# x y
# =========\======
# =========o======
# \=====
# z
x = ib.add_track_section(length=1)
Expand All @@ -104,7 +104,7 @@ def test_build(self):
def test_search_zone_paths():
ib = InfraBuilder()
# x y
# =========\======
# =========o======
# \=====
# z
x = ib.add_track_section(length=1)
Expand Down Expand Up @@ -141,7 +141,7 @@ class TestIncompleteRoute:
def test_from_zonepath(self):
ib = InfraBuilder()
# x y
# =========\======
# =========o======
# \=====
# z
x = ib.add_track_section(length=1)
Expand All @@ -163,7 +163,7 @@ def test_from_zonepath(self):
def test_fork_overlap(self):
ib = InfraBuilder()
# x y
# =========\======
# =========o======
# \=====
# z
x = ib.add_track_section(length=1)
Expand All @@ -187,7 +187,7 @@ def test_fork_overlap(self):
def test_fork(self):
ib = InfraBuilder()
# x y z
# ========d1========d2========
# ======d1=o=====d2=o=======
x = ib.add_track_section(length=1)
x.add_detector(position=0.75)
y = ib.add_track_section(length=1)
Expand All @@ -213,7 +213,7 @@ def test_fork(self):
def test_dir_waypoints(self):
ib = InfraBuilder()
# x y z
# ========d1========d2========
# ======d1=o=====d2=o=======
x = ib.add_track_section(length=1)
x.add_detector(position=0.75)
y = ib.add_track_section(length=1)
Expand Down Expand Up @@ -243,7 +243,7 @@ def test_dir_waypoints(self):
def test_waypoints(self):
ib = InfraBuilder()
# x y z
# ========d1========d2========
# ======d1=o=====d2=o=======
x = ib.add_track_section(length=1)
x.add_detector(position=0.75)
y = ib.add_track_section(length=1)
Expand All @@ -269,8 +269,9 @@ def test_waypoints(self):

def test_generate_route_paths():
ib = InfraBuilder()
# Possible routes are x->y, x->z, and mirrors.
# x y
# =========\======
# =========o======
# \=====
# z
x = ib.add_track_section(length=1)
Expand Down Expand Up @@ -343,8 +344,9 @@ def test_generate_route_paths():

def test_generate_routes_without_progressive_release():
ib = InfraBuilder()
# Possible routes are x->y, x->z, and mirrors.
# x y
# =========\======
# =========o======
# \=====
# z
x = ib.add_track_section(length=1)
Expand Down Expand Up @@ -393,8 +395,9 @@ def test_generate_routes_without_progressive_release():

def test_generate_routes():
ib = InfraBuilder()
# Possible routes are x->z, and z->x.
# x y z
# ========d1========d2========
# ======d1=o=====d2=o=======
x = ib.add_track_section(length=1)
x.add_detector(position=0.75)
y = ib.add_track_section(length=1)
Expand Down

0 comments on commit 7cf0649

Please sign in to comment.