Skip to content

Commit df7900b

Browse files
committed
added a test with refereree
1 parent fe97123 commit df7900b

File tree

3 files changed

+38
-5
lines changed

3 files changed

+38
-5
lines changed

shell.py

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,27 @@
44
from mpyq import MPQArchive
55
from datetime import datetime
66
from time import gmtime
7+
from events import EventParser
8+
from utils import MemFile
9+
import cProfile
10+
from pstats import Stats
11+
import time
712

8-
# replay = Replay("test_replays/build17811/1.sc2replay")
9-
# print replay.type
10-
# print replay.players[0].rgba
11-
# print "%02X%02X%02X" % (replay.players[0].rgba['r'], replay.players[0].rgba['g'], replay.players[0].rgba['b'])
13+
def test_bp():
14+
archive = MPQArchive("long.sc2replay", listfile=False)
15+
events = EventParser(MemFile(archive.read_file('replay.game.events')), 17811)
1216

13-
replay = Replay("13.sc2replay")
17+
for event in list(events):
18+
print event
19+
20+
def test_sc2():
21+
replay = Replay("long.sc2replay", False, True)
22+
print len(replay.events)
23+
24+
test_bp()
25+
26+
#cProfile.run("test_bp()", "replay_profile")
27+
#cProfile.run("test_sc2()", "replay_profile")
28+
29+
#stats = Stats("replay_profile")
30+
#stats.strip_dirs().sort_stats("time").print_stats(30)
78.1 KB
Binary file not shown.

test_replays/test_all.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,22 @@ def test_kr_realm_and_tampered_messages():
150150

151151
assert replay.messages[0].text == "sc2.replays.net"
152152
assert replay.messages[5].text == "sc2.replays.net"
153+
154+
print replay.players[1].choosen_race
155+
print replay.players[1].actual_race
156+
157+
print replay.players[0].choosen_race
158+
print replay.players[0].actual_race
159+
160+
print replay.map
161+
162+
assert 1 == 0
163+
164+
# TODO: Failing with
165+
# TypeError: Unknown event: 0x4 - 0xe3 at 16
166+
def test_referee():
167+
replay = Replay("test_replays/build17811/14.SC2Replay")
168+
153169

154170
# TODO: This currently fails for unknown reasons
155171
# It errors: "TypeError: Unknown event: 0x2 - 0xe at 4240"

0 commit comments

Comments
 (0)