File tree 2 files changed +10
-5
lines changed 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -72,10 +72,13 @@ def peek():
72
72
return stack [0 ]
73
73
74
74
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 ))
79
82
while stack :
80
83
assert_that (pop () == '(' and peek () == ';' )
81
84
while pop () == ';' :
Original file line number Diff line number Diff line change 3
3
from sgf_parsing import parse , SgfTree
4
4
5
5
6
+ # Tests adapted from `problem-specifications//canonical-data.json` @ v1.0.0
7
+
6
8
class SgfParsingTest (unittest .TestCase ):
7
9
def test_empty_input (self ):
8
10
input_string = ''
@@ -30,7 +32,7 @@ def test_single_node_tree(self):
30
32
self .assertEqual (parse (input_string ), expected )
31
33
32
34
def test_properties_without_delimiter (self ):
33
- input_string = '(;a )'
35
+ input_string = '(;A )'
34
36
with self .assertRaisesWithMessage (ValueError ):
35
37
parse (input_string )
36
38
You can’t perform that action at this time.
0 commit comments