Skip to content

Commit 2ff81f1

Browse files
thomasjpfancmccandless
authored andcommitted
update-sgf-parsing: updates tests to v1.0.0 (#1489)
Resolves #1447
1 parent ebfbbf7 commit 2ff81f1

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

exercises/sgf-parsing/example.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,13 @@ def peek():
7272
return stack[0]
7373

7474
def pop_until(ch):
75-
v = ''
76-
while peek() != ch:
77-
v += pop()
78-
return v
75+
try:
76+
v = ''
77+
while peek() != ch:
78+
v += pop()
79+
return v
80+
except IndexError:
81+
raise ValueError('Unable to find {}'.format(ch))
7982
while stack:
8083
assert_that(pop() == '(' and peek() == ';')
8184
while pop() == ';':

exercises/sgf-parsing/sgf_parsing_test.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
from sgf_parsing import parse, SgfTree
44

55

6+
# Tests adapted from `problem-specifications//canonical-data.json` @ v1.0.0
7+
68
class SgfParsingTest(unittest.TestCase):
79
def test_empty_input(self):
810
input_string = ''
@@ -30,7 +32,7 @@ def test_single_node_tree(self):
3032
self.assertEqual(parse(input_string), expected)
3133

3234
def test_properties_without_delimiter(self):
33-
input_string = '(;a)'
35+
input_string = '(;A)'
3436
with self.assertRaisesWithMessage(ValueError):
3537
parse(input_string)
3638

0 commit comments

Comments
 (0)