Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Flatland
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pranjal_dhole
Flatland
Commits
a186d58b
Commit
a186d58b
authored
3 years ago
by
nimishsantosh107
Browse files
Options
Downloads
Patches
Plain Diff
test persistence - added, file name typo in tests fixed
parent
0d809435
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/test_flatland_envs_persistence.py
+36
-0
36 additions, 0 deletions
tests/test_flatland_envs_persistence.py
tests/test_flatland_rail_agent_status.py
+0
-0
0 additions, 0 deletions
tests/test_flatland_rail_agent_status.py
with
36 additions
and
0 deletions
tests/test_flatland_envs_persistence.py
0 → 100644
+
36
−
0
View file @
a186d58b
import
numpy
as
np
from
flatland.envs.rail_env
import
RailEnv
from
flatland.envs.rail_generators
import
rail_from_grid_transition_map
from
flatland.envs.line_generators
import
sparse_line_generator
from
flatland.utils.simple_rail
import
make_simple_rail
from
flatland.envs.persistence
import
RailEnvPersister
def
test_load_new
():
filename
=
"
test_load_new.pkl
"
rail
,
rail_map
,
optionals
=
make_simple_rail
()
n_agents
=
2
env_initial
=
RailEnv
(
width
=
rail_map
.
shape
[
1
],
height
=
rail_map
.
shape
[
0
],
rail_generator
=
rail_from_grid_transition_map
(
rail
,
optionals
),
line_generator
=
sparse_line_generator
(),
number_of_agents
=
n_agents
)
env_initial
.
reset
(
False
,
False
)
rails_initial
=
env_initial
.
rail
.
grid
agents_initial
=
env_initial
.
agents
RailEnvPersister
.
save
(
env_initial
,
filename
)
env_loaded
,
_
=
RailEnvPersister
.
load_new
(
filename
)
rails_loaded
=
env_loaded
.
rail
.
grid
agents_loaded
=
env_loaded
.
agents
assert
np
.
all
(
np
.
array_equal
(
rails_initial
,
rails_loaded
))
assert
agents_initial
==
agents_loaded
def
main
():
pass
if
__name__
==
"
__main__
"
:
main
()
This diff is collapsed.
Click to expand it.
tests/test_fla
l
tland_rail_agent_status.py
→
tests/test_flatland_rail_agent_status.py
+
0
−
0
View file @
a186d58b
File moved
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment