From 481a53b4814dc0eb7a1981227f88450e37bff0e2 Mon Sep 17 00:00:00 2001 From: u229589 <christian.baumberger@sbb.ch> Date: Wed, 23 Oct 2019 16:34:07 +0200 Subject: [PATCH] implement review comment (issue #250) --- flatland/envs/rail_env.py | 2 ++ tests/test_flatland_envs_rail_env.py | 14 +------------- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/flatland/envs/rail_env.py b/flatland/envs/rail_env.py index 67131060..70312ecb 100644 --- a/flatland/envs/rail_env.py +++ b/flatland/envs/rail_env.py @@ -319,6 +319,8 @@ class RailEnv(Environment): if optionals and 'distance_map' in optionals: self.distance_map.set(optionals['distance_map']) + # todo change self.agents_static[0] with the refactoring for agents_static -> issue nr. 185 + # https://gitlab.aicrowd.com/flatland/flatland/issues/185 if regenerate_schedule or self.agents_static[0] is None: agents_hints = None if optionals and 'agents_hints' in optionals: diff --git a/tests/test_flatland_envs_rail_env.py b/tests/test_flatland_envs_rail_env.py index bee91c11..dc4c78f9 100644 --- a/tests/test_flatland_envs_rail_env.py +++ b/tests/test_flatland_envs_rail_env.py @@ -232,7 +232,7 @@ def test_get_entry_directions(): def test_rail_env_reset(): file_name = "test_rail_env_reset.pkl" - # Test to save and load file with distance map. + # Test to save and load file. rail, rail_map = make_simple_rail() @@ -264,10 +264,6 @@ def test_rail_env_reset(): assert np.all(np.array_equal(rails_initial, rails_loaded)) assert agents_initial == agents_loaded - # Check that distance map was not recomputed - assert np.shape(env2.distance_map.get()) == dist_map_shape - assert env2.distance_map.get() is not None - env3 = RailEnv(width=1, height=1, rail_generator=rail_from_file(file_name), @@ -282,10 +278,6 @@ def test_rail_env_reset(): assert np.all(np.array_equal(rails_initial, rails_loaded)) assert agents_initial == agents_loaded - # Check that distance map was not recomputed - assert np.shape(env3.distance_map.get()) == dist_map_shape - assert env3.distance_map.get() is not None - env4 = RailEnv(width=1, height=1, rail_generator=rail_from_file(file_name), @@ -299,7 +291,3 @@ def test_rail_env_reset(): assert np.all(np.array_equal(rails_initial, rails_loaded)) assert agents_initial == agents_loaded - - # Check that distance map was not recomputed - assert np.shape(env4.distance_map.get()) == dist_map_shape - assert env4.distance_map.get() is not None -- GitLab