11# Run tests with "py.test" in the project root dir
2-
3- # TODO:
4- # - Performance tests to measure the effect of optimizations
52import os , sys
6- from timeit import Timer
73import pytest
84
9- sys .path .append (os .path .join (os .path .dirname (os .path .abspath (__file__ )),"../" ))
5+ #sys.path.append(os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)),"../")))
6+ sys .path .insert (0 , os .path .normpath (os .path .join (os .path .dirname (os .path .abspath (__file__ )),"../" )))
7+
108from sc2reader import Replay
119from sc2reader .exceptions import ParseError
1210
@@ -42,6 +40,7 @@ def test_1():
4240 assert replay .release_string == "1.2.2.17811"
4341 assert replay .speed == "Faster"
4442 assert replay .type == "1v1"
43+ # TODO: library should probably provide helper functions and/or constants to check this
4544 assert replay .category == "Ladder"
4645
4746 assert len (replay .players ) == 2
@@ -96,4 +95,18 @@ def test_1():
9695 assert replay .messages [11 ].player .name == "Boom"
9796
9897 for msg in replay .messages :
99- assert sent_to_all (msg ) == True
98+ assert sent_to_all (msg ) == True
99+
100+ def test_2 ():
101+ replay = Replay ("test_replays/build17811/2.sc2replay" )
102+
103+ # TODO: library should probably provide helper functions and/or constants to check this
104+ assert replay .category == "Private"
105+
106+ def test_3 ():
107+ replay = Replay ("test_replays/build17811/3.sc2replay" )
108+
109+ assert replay .type == "3v3"
110+ assert len (replay .messages ) == 25
111+
112+ # TODO: Test 2v2, 4v4 and FFA
0 commit comments