Skip to content

Commit f2e915a

Browse files
committed
Fix tests
1 parent ada9bdb commit f2e915a

File tree

2 files changed

+47
-12
lines changed

2 files changed

+47
-12
lines changed

test/generate_pickle_files_bot.py

Lines changed: 43 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,27 +76,63 @@ async def on_start_async(self):
7676
def main():
7777

7878
maps = [
79+
"16-BitLE.SC2Map",
80+
"AbiogenesisLE",
81+
"AbyssalReefLE",
82+
"AcidPlantLE",
83+
"AcolyteLE",
7984
"Acropolis",
8085
"Artana",
81-
"CrystalCavern",
82-
"DigitalFrontier",
83-
"OldSunshine",
84-
"Treachery",
85-
"Triton",
86+
"AscensiontoAiurLE",
8687
"AutomatonLE",
88+
"BackwaterLE",
89+
"Bandwidth",
90+
"BattleontheBoardwalkLE",
91+
"BelShirVestigeLE",
92+
"BlackpinkLE",
93+
"BloodBoilLE",
8794
"BlueshiftLE",
95+
"CactusValleyLE",
96+
"CatalystLE",
8897
"CeruleanFallLE",
98+
"CrystalCavern",
99+
"CyberForestLE",
89100
"DarknessSanctuaryLE",
101+
"DefendersLandingLE",
102+
"DigitalFrontier",
103+
"DreamcatcherLE",
104+
"EastwatchLE",
105+
"Ephemeron",
106+
"FractureLE",
107+
"FrostLE",
108+
"HonorgroundsLE",
109+
"InterloperLE",
110+
"KairosJunctionLE",
90111
"KairosJunctionLE",
112+
"KingsCoveLE",
113+
"LostandFoundLE",
114+
"MechDepotLE",
115+
"NeonVioletSquareLE",
116+
"NewkirkPrecinctTE",
117+
"NewRepugnancyLE",
118+
"OdysseyLE",
119+
"OldSunshine",
120+
"PaladinoTerminalLE",
121+
"ParaSiteLE",
91122
"ParaSiteLE",
92123
"PortAleksanderLE",
93-
"Bandwidth",
94-
"Ephemeron",
95124
"PrimusQ9",
125+
"ProximaStationLE",
126+
"RedshiftLE",
96127
"Reminiscence",
97128
"Sanglune",
129+
"SequencerLE",
130+
# "StasisLE", Commented out because it has uneven number of expansions
98131
"TheTimelessVoid",
132+
"Treachery",
133+
"Triton",
99134
"Urzagol",
135+
"YearZeroLE",
100136
]
101137

102138
for map in maps:
@@ -106,7 +142,6 @@ def main():
106142
sc2.maps.get(map),
107143
[Bot(Race.Terran, ExporterBot()), Computer(Race.Zerg, Difficulty.Easy)],
108144
realtime=False,
109-
save_replay_as="Example.SC2Replay",
110145
)
111146
except ProtocolError:
112147
# ProtocolError appears after a leave game request

test/test_pickled_data.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -565,10 +565,10 @@ def test_position_pointlike(self, bot: BotAI, x1, y1, x2, y2, x3, y3):
565565
dist_furthest_point = pos1._distance_squared(furthest_point) ** 0.5
566566

567567
# Distances between pos1-pos2 and pos1-pos3 might be the same, so the sorting might still be different, that's why I use a set here
568-
assert pos1.closest(points) in {p for p in points2 if pos1.distance_to(p) == dist_closest_point}
569-
assert pos1.distance_to_closest(points) == pos1._distance_squared(closest_point) ** 0.5
570-
assert pos1.furthest(points) in {p for p in points2 if pos1.distance_to(p) == dist_furthest_point}
571-
assert pos1.distance_to_furthest(points) == pos1._distance_squared(furthest_point) ** 0.5
568+
assert pos1.closest(points) in {p for p in points2 if abs(pos1.distance_to(p) - dist_closest_point) < epsilon}
569+
assert abs(pos1.distance_to_closest(points) - pos1._distance_squared(closest_point) ** 0.5) < epsilon
570+
assert pos1.furthest(points) in {p for p in points2 if abs(pos1.distance_to(p) - dist_furthest_point) < epsilon}
571+
assert abs(pos1.distance_to_furthest(points) - pos1._distance_squared(furthest_point) ** 0.5) < epsilon
572572
assert pos1.offset(pos2) == Point2((pos1.x + pos2.x, pos1.y + pos2.y))
573573
if pos1 != pos2:
574574
assert pos1.unit_axes_towards(pos2) != Point2((0, 0))

0 commit comments

Comments
 (0)