Skip to content

Commit

Permalink
Fix a closed file error
Browse files Browse the repository at this point in the history
  • Loading branch information
Thom1729 committed Sep 22, 2021
1 parent 4dc9f07 commit 1bce567
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions tests/lib/test_structure.py
Expand Up @@ -39,12 +39,14 @@ def test_structure(data_filename, structure_filename, verbose=False):
try:
with open(data_filename, 'rb') as file:
loader = yaml.Loader(file)
while loader.check_event():
if loader.check_event(yaml.StreamStartEvent, yaml.StreamEndEvent,
yaml.DocumentStartEvent, yaml.DocumentEndEvent):
loader.get_event()
continue
nodes1.append(_convert_structure(loader))
while loader.check_event():
if loader.check_event(
yaml.StreamStartEvent, yaml.StreamEndEvent,
yaml.DocumentStartEvent, yaml.DocumentEndEvent
):
loader.get_event()
continue
nodes1.append(_convert_structure(loader))
if len(nodes1) == 1:
nodes1 = nodes1[0]
assert nodes1 == nodes2, (nodes1, nodes2)
Expand Down

0 comments on commit 1bce567

Please sign in to comment.