Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add test for print functionality.
Load a lotv replay and print all the events to ensure they print.
The output from the prints have been redirected to a stream using
StringIO and then checked for the last few events to occur.
  • Loading branch information
Gusgus01 committed Oct 31, 2018
commit 5cdfad17f6245a9680ad05d2c7b24dd05a47e7ef
14 changes: 14 additions & 0 deletions test_replays/test_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
import unittest2 as unittest
else:
import unittest
# StringIO was changed in python 3
try:
from io import StringIO
except ImportError:
from StringIO import StringIO

import sc2reader
from sc2reader.exceptions import CorruptTrackerFileError
Expand Down Expand Up @@ -582,6 +587,15 @@ def test_65895(self):
factory = sc2reader.factories.SC2Factory()
replay = factory.load_replay(replayfilename)

def test_event_print(self):
replay = sc2reader.load_replay("test_replays/lotv/lotv1.SC2Replay")
with StringIO() as capturedOutput:
sys.stdout = capturedOutput
for event in replay.events:
print(event)
self.assertIn("PlayerLeaveEvent", capturedOutput.getvalue())
sys.stdout = sys.__stdout__


class TestGameEngine(unittest.TestCase):
class TestEvent(object):
Expand Down