Skip to content

Commit 15c06f9

Browse files
committed
add test for the Central Protocol map which had a new kind of mineral field object
1 parent f2787f6 commit 15c06f9

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed
52.1 KB
Binary file not shown.

test_replays/test_all.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import datetime
55
import json
6+
from xml.dom import minidom
67

78
# Newer unittest features aren't built in for python 2.6
89
import sys
@@ -466,6 +467,16 @@ def test_38996(self):
466467
self.assertEqual(replay.expansion, 'LotV')
467468
replay = sc2reader.load_replay("test_replays/3.0.0.38996/2.SC2Replay")
468469
self.assertEqual(replay.expansion, 'LotV')
470+
471+
def test_funny_minerals(self):
472+
replay = sc2reader.load_replay("test_replays/3.1.0/centralprotocol.SC2Replay")
473+
replay.load_map()
474+
xmldoc = minidom.parseString(replay.map.archive.read_file('Objects'))
475+
itemlist = xmldoc.getElementsByTagName('ObjectUnit')
476+
mineralPosStrs = [ou.attributes['Position'].value for ou in itemlist if 'MineralField' in ou.attributes['UnitType'].value]
477+
mineralFieldNames = list(set([ou.attributes['UnitType'].value for ou in itemlist if 'MineralField' in ou.attributes['UnitType'].value]))
478+
#print mineralFieldNames
479+
self.assertTrue(len(mineralPosStrs) > 0)
469480

470481

471482
class TestGameEngine(unittest.TestCase):

0 commit comments

Comments
 (0)