Skip to content

Commit 0191d2f

Browse files
committed
Merge remote-tracking branch 'graylin/hots'
2 parents ab2370c + 11ea132 commit 0191d2f

File tree

5 files changed

+19
-2
lines changed

5 files changed

+19
-2
lines changed

sc2reader/resources.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -987,7 +987,7 @@ def load_players(self):
987987
if not struct[0][1]: continue # Slot is closed
988988

989989
player = PlayerSummary(struct[0][0])
990-
stats = self.player_stats[index]
990+
stats = self.player_stats.get(index, dict())
991991
settings = self.player_settings[index]
992992
player.is_ai = not isinstance(struct[0][1], dict)
993993
if not player.is_ai:

sc2reader/scripts/sc2parse.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def main():
4343
replay = sc2reader.load_replay(path, debug=True, load_level=1)
4444
if not args.one_each or replay.is_ladder:
4545
replay = sc2reader.load_replay(path, debug=True)
46-
print 'No problems with {build} - {real_type} on {map_name} - Played {start_time}'.format(**replay.__dict__)
46+
print 'No problems with {path}: {build} - {real_type} on {map_name} - Played {start_time}'.format(path=path, **replay.__dict__)
4747
except sc2reader.exceptions.ReadError as e:
4848
if args.ladder_only and not e.replay.is_ladder: continue
4949

test_s2gs/hots1.s2gs

14.1 KB
Binary file not shown.

test_s2gs/s2gs1.s2gs

8.56 KB
Binary file not shown.

test_s2gs/test_all_s2gs.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Encoding: UTF-8
2+
3+
# Run tests with "py.test" in the project root dir
4+
import os, sys
5+
import pytest
6+
import datetime
7+
8+
sys.path.insert(0, os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)),"../")))
9+
10+
import sc2reader
11+
from sc2reader.exceptions import ParseError
12+
13+
def test_a_WoL_s2gs():
14+
summary = sc2reader.load_game_summary("test_s2gs/s2gs1.s2gs")
15+
16+
def test_a_HotS_s2gs():
17+
summary = sc2reader.load_game_summary("test_s2gs/hots1.s2gs")

0 commit comments

Comments
 (0)