aboutsummaryrefslogtreecommitdiff
path: root/tests/test_parseHelpers.py
diff options
context:
space:
mode:
authorInigoGutierrez <inigogf.95@gmail.com>2023-06-12 20:16:04 +0200
committerInigoGutierrez <inigogf.95@gmail.com>2023-06-12 20:16:04 +0200
commitd4a81490bf1396089eb3dac5955a3a8e4cb26e37 (patch)
treef96febc7950c2742bc36f04ab13bff56851f2388 /tests/test_parseHelpers.py
parentb08408d23186205e71dfc68634021e3236bfb45c (diff)
parent65ac3a6b050dcb88688cdc2654b1ed6693e9a160 (diff)
downloadimago-d4a81490bf1396089eb3dac5955a3a8e4cb26e37.tar.gz
imago-d4a81490bf1396089eb3dac5955a3a8e4cb26e37.zip
Merge branch 'devel'HEADmaster
Diffstat (limited to 'tests/test_parseHelpers.py')
-rw-r--r--tests/test_parseHelpers.py36
1 files changed, 20 insertions, 16 deletions
diff --git a/tests/test_parseHelpers.py b/tests/test_parseHelpers.py
index 7bbf152..c1405fb 100644
--- a/tests/test_parseHelpers.py
+++ b/tests/test_parseHelpers.py
@@ -26,7 +26,7 @@ class TestParseHelpers(unittest.TestCase):
)
parsedMove = parseHelpers.parseMove(["B", "t1"], TEST_BOARD_SIZE)
- targetMove = parseHelpers.GtpMove(Player.BLACK, [18, 18])
+ targetMove = parseHelpers.GtpMove(Player.BLACK, (18, 18))
self.assertEqual(parsedMove.color, targetMove.color)
self.assertEqual(parsedMove.vertex, targetMove.vertex)
@@ -54,26 +54,26 @@ class TestParseHelpers(unittest.TestCase):
"""Test correct inputs and their resulting coordinates for parseVertex."""
self.assertEqual(parseHelpers.parseVertex(
"a1", TEST_BOARD_SIZE),
- [18,0])
+ (18,0))
self.assertEqual(parseHelpers.parseVertex(
"b1", TEST_BOARD_SIZE),
- [18,1])
+ (18,1))
self.assertEqual(parseHelpers.parseVertex(
"a2", TEST_BOARD_SIZE),
- [17,0])
+ (17,0))
self.assertEqual(parseHelpers.parseVertex(
"b2", TEST_BOARD_SIZE),
- [17,1])
+ (17,1))
self.assertEqual(parseHelpers.parseVertex(
"T1", TEST_BOARD_SIZE),
- [18,18])
+ (18,18))
self.assertEqual(parseHelpers.parseVertex(
"T19", TEST_BOARD_SIZE),
- [0,18])
+ (0,18))
self.assertEqual(parseHelpers.parseVertex(
"A19", TEST_BOARD_SIZE),
- [0,0])
+ (0,0))
self.assertEqual(parseHelpers.parseVertex(
"pass", TEST_BOARD_SIZE),
@@ -81,10 +81,14 @@ class TestParseHelpers(unittest.TestCase):
def testVertexToString(self):
"""Test converting vertices to strings."""
- self.assertEqual(parseHelpers.vertexToString([0,0], TEST_BOARD_SIZE), "A19")
- self.assertEqual(parseHelpers.vertexToString([1,0], TEST_BOARD_SIZE), "A18")
- self.assertEqual(parseHelpers.vertexToString([2,0], TEST_BOARD_SIZE), "A17")
- self.assertEqual(parseHelpers.vertexToString([0,1], TEST_BOARD_SIZE), "B19")
+
+ # Try with vertices as tuples
+ self.assertEqual(parseHelpers.vertexToString((0,0), TEST_BOARD_SIZE), "A19")
+ self.assertEqual(parseHelpers.vertexToString((1,0), TEST_BOARD_SIZE), "A18")
+ self.assertEqual(parseHelpers.vertexToString((2,0), TEST_BOARD_SIZE), "A17")
+ self.assertEqual(parseHelpers.vertexToString((0,1), TEST_BOARD_SIZE), "B19")
+
+ # Try with vertices as arrays
self.assertEqual(parseHelpers.vertexToString([0,2], TEST_BOARD_SIZE), "C19")
self.assertEqual(parseHelpers.vertexToString([0,18], TEST_BOARD_SIZE), "T19")
self.assertEqual(parseHelpers.vertexToString([18,0], TEST_BOARD_SIZE), "A1")
@@ -93,10 +97,10 @@ class TestParseHelpers(unittest.TestCase):
self.assertEqual(parseHelpers.vertexToString("pass", TEST_BOARD_SIZE), "pass")
wrongVertices = [
- [-1,0],
- [0,-1],
- [-1,-1],
- [19,0],
+ (-1,0),
+ (0,-1),
+ (-1,-1),
+ (19,0),
[0,19],
[19,19],
[0],