Skip to content

Commit b59d733

Browse files
committed
Take 3. Its like whack-a-mole in here.
1 parent ba28396 commit b59d733

File tree

4 files changed

+20
-20
lines changed

4 files changed

+20
-20
lines changed

sc2reader/objects.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ def __init__(self, x, y, xy_list=None):
404404

405405
def as_points(self):
406406
""" Get the graph as a list of (x, y) tuples """
407-
return zip(self.times, self.values)
407+
return list(zip(self.times, self.values))
408408

409409
def __str__(self):
410410
return "Graph with {0} values".format(len(self.times))

sc2reader/resources.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ def __init__(self, summary_file, filename=None, lang='enUS', **options):
737737
self.parts.append(buffer.read_struct())
738738

739739
self.end_time = datetime.utcfromtimestamp(self.parts[0][8])
740-
self.game_speed = LOBBY_PROPERTIES[0xBB8][1][self.parts[0][0][1]]
740+
self.game_speed = LOBBY_PROPERTIES[0xBB8][1][self.parts[0][0][1].decode('utf8')]
741741
self.game_length = utils.Length(seconds=self.parts[0][7])
742742
self.real_length = utils.Length(seconds=int(self.parts[0][7]/GAME_SPEED_FACTOR[self.game_speed]))
743743
self.start_time = datetime.utcfromtimestamp(self.parts[0][8] - self.real_length.seconds)
@@ -803,16 +803,16 @@ def load_translations(self):
803803
#
804804
# Sometimes these byte strings are all NULLed out and need to be ignored.
805805
for localization in self.parts[0][6][8]:
806-
language = localization[0]
806+
language = localization[0].decode('utf8')
807807

808808
files = list()
809809
for file_hash in localization[1]:
810-
if file_hash[:4] != '\x00\x00\x00\x00':
810+
if file_hash[:4].decode('utf8') != '\x00\x00\x00\x00':
811811
files.append(utils.DepotFile(file_hash))
812812
self.localization_urls[language] = files
813813

814814
# Grab the gateway from the one of the files
815-
self.gateway = self.localization_urls.values()[0][0].server.lower()
815+
self.gateway = list(self.localization_urls.values())[0][0].server.lower()
816816

817817
# Each of the localization urls points to an XML file with a set of
818818
# localization strings and their unique ids. After reading these mappings

test_replays/test_all.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
# Newer unittest features aren't built in for python 2.6
88
import sys
9-
if sys.version_info[:2] <= (2, 7):
9+
if sys.version_info[:2] < (2, 7):
1010
import unittest2 as unittest
1111
else:
1212
import unittest

test_s2gs/test_all.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,26 +15,26 @@ class TestSummaries(unittest.TestCase):
1515

1616
def test_a_WoL_s2gs(self):
1717
summary = sc2reader.load_game_summary("test_s2gs/s2gs1.s2gs")
18-
self.assertEquals(summary.players[0].resource_collection_rate, 1276)
19-
self.assertEquals(summary.players[0].build_order[0].order, 'Probe')
20-
self.assertEquals(summary.expansion, 'WoL')
18+
self.assertEqual(summary.players[0].resource_collection_rate, 1276)
19+
self.assertEqual(summary.players[0].build_order[0].order, 'Probe')
20+
self.assertEqual(summary.expansion, 'WoL')
2121

2222
def test_a_HotS_s2gs(self):
2323
summary = sc2reader.load_game_summary("test_s2gs/hots1.s2gs")
24-
self.assertEquals(summary.players[0].resource_collection_rate, 1599)
25-
self.assertEquals(summary.players[0].build_order[0].order, 'SCV')
26-
self.assertEquals(summary.expansion, 'HotS')
24+
self.assertEqual(summary.players[0].resource_collection_rate, 1599)
25+
self.assertEqual(summary.players[0].build_order[0].order, 'SCV')
26+
self.assertEqual(summary.expansion, 'HotS')
2727

2828
def test_another_HotS_s2gs(self):
2929
summary = sc2reader.load_game_summary("test_s2gs/hots2.s2gs")
30-
self.assertEquals(summary.players[0].enemies_destroyed, 14575)
31-
self.assertEquals(summary.players[0].time_supply_capped, 50)
32-
self.assertEquals(summary.players[0].idle_production_time, 4438)
33-
self.assertEquals(summary.players[0].resources_spent, 25450)
34-
self.assertEquals(summary.players[0].apm, 204)
35-
self.assertEquals(summary.players[0].workers_active_graph.as_points()[8][1], 25)
36-
self.assertEquals(summary.players[0].upgrade_spending_graph.as_points()[8][1], 300)
37-
self.assertEquals(summary.expansion, 'HotS')
30+
self.assertEqual(summary.players[0].enemies_destroyed, 14575)
31+
self.assertEqual(summary.players[0].time_supply_capped, 50)
32+
self.assertEqual(summary.players[0].idle_production_time, 4438)
33+
self.assertEqual(summary.players[0].resources_spent, 25450)
34+
self.assertEqual(summary.players[0].apm, 204)
35+
self.assertEqual(summary.players[0].workers_active_graph.as_points()[8][1], 25)
36+
self.assertEqual(summary.players[0].upgrade_spending_graph.as_points()[8][1], 300)
37+
self.assertEqual(summary.expansion, 'HotS')
3838

3939
if __name__ == '__main__':
4040
unittest.main()

0 commit comments

Comments
 (0)