Skip to content

Commit 47b120e

Browse files
committed
added few tests
1 parent 487f67f commit 47b120e

File tree

7 files changed

+50
-10
lines changed

7 files changed

+50
-10
lines changed

mpyq.egg-info/PKG-INFO

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Metadata-Version: 1.0
2+
Name: mpyq
3+
Version: 0.1.4
4+
Summary: A Python library for extracting MPQ (MoPaQ) files.
5+
Home-page: http://github.com/arkx/mpyq/
6+
Author: Aku Kotkavuo
7+
Author-email: [email protected]
8+
License: UNKNOWN
9+
Description: UNKNOWN
10+
Platform: UNKNOWN
11+
Classifier: Development Status :: 3 - Alpha
12+
Classifier: Environment :: Console
13+
Classifier: Intended Audience :: End Users/Desktop
14+
Classifier: Intended Audience :: Developers
15+
Classifier: License :: OSI Approved :: BSD License
16+
Classifier: Operating System :: MacOS :: MacOS X
17+
Classifier: Operating System :: Microsoft :: Windows
18+
Classifier: Operating System :: POSIX
19+
Classifier: Programming Language :: Python :: 2.7
20+
Classifier: Topic :: Games/Entertainment :: Real Time Strategy
21+
Classifier: Topic :: Software Development :: Libraries
22+
Classifier: Topic :: System :: Archiving

mpyq.egg-info/SOURCES.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
LICENSE
2+
MANIFEST.in
3+
README.md
4+
mpyq.py
5+
setup.py
6+
mpyq.egg-info/PKG-INFO
7+
mpyq.egg-info/SOURCES.txt
8+
mpyq.egg-info/dependency_links.txt
9+
mpyq.egg-info/entry_points.txt
10+
mpyq.egg-info/top_level.txt
11+
test/test_mpqarchive.py

mpyq.egg-info/dependency_links.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

mpyq.egg-info/entry_points.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[console_scripts]
2+
mpyq = mpyq:main
3+

mpyq.egg-info/top_level.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
mpyq

sc2reader/replay.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@
22
from collections import defaultdict
33

44
from mpyq import MPQArchive
5-
from mpyq import __version__ as version
6-
print version
75

86
import parsers
9-
from utils import ByteStream,PlayerDict
7+
from utils import ByteStream, PlayerDict
108

119
class Replay(object):
1210

test_replays/test_all.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,34 +88,39 @@ def test_standard_1v1():
8888

8989
def test_private_category():
9090
replay = Replay("test_replays/build17811/2.sc2replay")
91-
9291
assert replay.is_private == True
9392
assert replay.is_ladder == False
9493

9594
def test_2v2():
96-
# Source: http://drop.sc/82
9795
replay = Replay("test_replays/build17811/7.sc2replay")
9896
assert replay.type == "2v2"
9997

10098
def test_3v3():
10199
replay = Replay("test_replays/build17811/3.sc2replay")
102-
103100
assert replay.type == "3v3"
104101

105102
# Because it's a 3v3 and all of the members of Team 2 quit, we should know the winner.
106103
assert replay.results[1] == "Won"
107104
assert replay.results[2] == "Lost"
108105

109106
def test_4v4():
110-
# Source: http://drop.sc/32
111107
replay = Replay("test_replays/build17811/9.sc2replay")
112108
assert replay.type == "4v4"
113109

114110
def test_ffa():
115-
# Source: http://drop.sc/83
116111
replay = Replay("test_replays/build17811/8.sc2replay")
117112
assert replay.type == "FFA"
118-
assert replay.player['Boom'].result == "Won"
113+
114+
# Player 'Boom' won because the last building of the last player was destroyed,
115+
# but the winner cannot be parsed because "Player has left" event isn't generated.
116+
# Unknown result is the best we can do.
117+
assert replay.winner_known == False
118+
119+
def test_unknown_winner():
120+
replay = Replay("test_replays/build17811/10.sc2replay")
121+
122+
# Recording player (Boom) left second, so the winner shouldn't be known
123+
assert replay.winner_known == False
119124

120125
def test_random_player():
121126
replay = Replay("test_replays/build17811/3.sc2replay")
@@ -132,7 +137,6 @@ def test_random_player2():
132137

133138
def test_us_realm():
134139
replay = Replay("test_replays/build17811/5.sc2replay")
135-
136140
assert replay.player['ShadesofGray'].url == "http://us.battle.net/sc2/en/profile/2358439/1/ShadesofGray/"
137141
assert replay.player['reddawn'].url == "http://us.battle.net/sc2/en/profile/2198663/1/reddawn/"
138142

0 commit comments

Comments
 (0)