From f8afd304498dd66af1a820f2cc9700c92cc21b3c Mon Sep 17 00:00:00 2001
From: u214892 <u214892@sbb.ch>
Date: Mon, 17 Jun 2019 22:52:04 +0200
Subject: [PATCH] #66 cleanup

---
 flatland/envs/env_utils.py         | 12 ------------
 tests/envs/__init__.py             |  0
 tests/{ => envs}/test_env_utils.py | 14 +++++++-------
 3 files changed, 7 insertions(+), 19 deletions(-)
 create mode 100644 tests/envs/__init__.py
 rename tests/{ => envs}/test_env_utils.py (67%)

diff --git a/flatland/envs/env_utils.py b/flatland/envs/env_utils.py
index 8ee120a4..cc4a0015 100644
--- a/flatland/envs/env_utils.py
+++ b/flatland/envs/env_utils.py
@@ -291,18 +291,6 @@ def distance_on_rail(pos1, pos2):
     return abs(pos1[0] - pos2[0]) + abs(pos1[1] - pos2[1])
 
 
-def get_new_position(position, movement):
-    """ Utility function that converts a compass movement over a 2D grid to new positions (r, c). """
-    if movement == Grid4TransitionsEnum.NORTH:
-        return (position[0] - 1, position[1])
-    elif movement == Grid4TransitionsEnum.EAST:
-        return (position[0], position[1] + 1)
-    elif movement == Grid4TransitionsEnum.SOUTH:
-        return (position[0] + 1, position[1])
-    elif movement == Grid4TransitionsEnum.WEST:
-        return (position[0], position[1] - 1)
-
-
 def get_rnd_agents_pos_tgt_dir_on_rail(rail, num_agents):
     """
     Given a `rail' GridTransitionMap, return a random placement of agents (initial position, direction and target).
diff --git a/tests/envs/__init__.py b/tests/envs/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/tests/test_env_utils.py b/tests/envs/test_env_utils.py
similarity index 67%
rename from tests/test_env_utils.py
rename to tests/envs/test_env_utils.py
index 467051ed..25952031 100644
--- a/tests/test_env_utils.py
+++ b/tests/envs/test_env_utils.py
@@ -24,10 +24,10 @@ def test_coordinate_to_position():
 
 
 def test_get_direction():
-    assert get_direction((0,0),(0,1)) == Grid4TransitionsEnum.EAST
-    assert get_direction((0,0),(0,2)) == Grid4TransitionsEnum.EAST
-    assert get_direction((0,0),(1,0)) == Grid4TransitionsEnum.SOUTH
-    assert get_direction((1,0),(0,0)) == Grid4TransitionsEnum.NORTH
-    assert get_direction((1,0),(0,0)) == Grid4TransitionsEnum.NORTH
-    with pytest.raises(Exception,match="Could not determine direction"):
-        get_direction((0,0),(0,0)) == Grid4TransitionsEnum.NORTH
+    assert get_direction((0, 0), (0, 1)) == Grid4TransitionsEnum.EAST
+    assert get_direction((0, 0), (0, 2)) == Grid4TransitionsEnum.EAST
+    assert get_direction((0, 0), (1, 0)) == Grid4TransitionsEnum.SOUTH
+    assert get_direction((1, 0), (0, 0)) == Grid4TransitionsEnum.NORTH
+    assert get_direction((1, 0), (0, 0)) == Grid4TransitionsEnum.NORTH
+    with pytest.raises(Exception, match="Could not determine direction"):
+        get_direction((0, 0), (0, 0)) == Grid4TransitionsEnum.NORTH
-- 
GitLab