Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_debugprintgame(parser):
with open(logfile("23576_debugprintgame.power.log")) as f:
parser.read(f)
assert parser.game_meta == {
"BuildNumber": 23576,
"FormatType": FormatType.FT_WILD,
"GameType": GameType.GT_RANKED,
"ScenarioID": 2,
}
def as_bnet(self, wild=False):
if self == GameType.GT_RANKED:
return BnetGameType.BGT_RANKED_WILD if wild else BnetGameType.BGT_RANKED_STANDARD
if self == GameType.GT_CASUAL:
return BnetGameType.BGT_CASUAL_WILD if wild else BnetGameType.BGT_CASUAL_STANDARD
return {
GameType.GT_UNKNOWN: BnetGameType.BGT_UNKNOWN,
GameType.GT_VS_AI: BnetGameType.BGT_VS_AI,
GameType.GT_VS_FRIEND: BnetGameType.BGT_FRIENDS,
GameType.GT_TUTORIAL: BnetGameType.BGT_TUTORIAL,
GameType.GT_ARENA: BnetGameType.BGT_ARENA,
GameType.GT_TEST_AI_VS_AI: BnetGameType.BGT_TEST1,
GameType.GT_TAVERNBRAWL: BnetGameType.BGT_TAVERNBRAWL_PVP,
GameType.GT_TB_1P_VS_AI: BnetGameType.BGT_TAVERNBRAWL_1P_VERSUS_AI,
GameType.GT_TB_2P_COOP: BnetGameType.BGT_TAVERNBRAWL_2P_COOP,
GameType.GT_FSG_BRAWL_VS_FRIEND: BnetGameType.BGT_FSG_BRAWL_VS_FRIEND,
GameType.GT_FSG_BRAWL: BnetGameType.BGT_FSG_BRAWL_PVP,
GameType.GT_FSG_BRAWL_1P_VS_AI: BnetGameType.BGT_FSG_BRAWL_1P_VERSUS_AI,
GameType.GT_FSG_BRAWL_2P_COOP: BnetGameType.BGT_FSG_BRAWL_2P_COOP,
GameType.GT_BATTLEGROUNDS: BnetGameType.BGT_BATTLEGROUNDS,
# GameType.GT_LAST: BnetGameType.BGT_LAST,
}[self]
return BnetGameType.BGT_RANKED_WILD if wild else BnetGameType.BGT_RANKED_STANDARD
if self == GameType.GT_CASUAL:
return BnetGameType.BGT_CASUAL_WILD if wild else BnetGameType.BGT_CASUAL_STANDARD
return {
GameType.GT_UNKNOWN: BnetGameType.BGT_UNKNOWN,
GameType.GT_VS_AI: BnetGameType.BGT_VS_AI,
GameType.GT_VS_FRIEND: BnetGameType.BGT_FRIENDS,
GameType.GT_TUTORIAL: BnetGameType.BGT_TUTORIAL,
GameType.GT_ARENA: BnetGameType.BGT_ARENA,
GameType.GT_TEST_AI_VS_AI: BnetGameType.BGT_TEST1,
GameType.GT_TAVERNBRAWL: BnetGameType.BGT_TAVERNBRAWL_PVP,
GameType.GT_TB_1P_VS_AI: BnetGameType.BGT_TAVERNBRAWL_1P_VERSUS_AI,
GameType.GT_TB_2P_COOP: BnetGameType.BGT_TAVERNBRAWL_2P_COOP,
GameType.GT_FSG_BRAWL_VS_FRIEND: BnetGameType.BGT_FSG_BRAWL_VS_FRIEND,
GameType.GT_FSG_BRAWL: BnetGameType.BGT_FSG_BRAWL_PVP,
GameType.GT_FSG_BRAWL_1P_VS_AI: BnetGameType.BGT_FSG_BRAWL_1P_VERSUS_AI,
GameType.GT_FSG_BRAWL_2P_COOP: BnetGameType.BGT_FSG_BRAWL_2P_COOP,
GameType.GT_BATTLEGROUNDS: BnetGameType.BGT_BATTLEGROUNDS,
# GameType.GT_LAST: BnetGameType.BGT_LAST,
}[self]
def as_bnet(self, wild=False):
if self == GameType.GT_RANKED:
return BnetGameType.BGT_RANKED_WILD if wild else BnetGameType.BGT_RANKED_STANDARD
if self == GameType.GT_CASUAL:
return BnetGameType.BGT_CASUAL_WILD if wild else BnetGameType.BGT_CASUAL_STANDARD
return {
GameType.GT_UNKNOWN: BnetGameType.BGT_UNKNOWN,
GameType.GT_VS_AI: BnetGameType.BGT_VS_AI,
GameType.GT_VS_FRIEND: BnetGameType.BGT_FRIENDS,
GameType.GT_TUTORIAL: BnetGameType.BGT_TUTORIAL,
GameType.GT_ARENA: BnetGameType.BGT_ARENA,
GameType.GT_TEST_AI_VS_AI: BnetGameType.BGT_TEST1,
GameType.GT_TAVERNBRAWL: BnetGameType.BGT_TAVERNBRAWL_PVP,
GameType.GT_TB_1P_VS_AI: BnetGameType.BGT_TAVERNBRAWL_1P_VERSUS_AI,
GameType.GT_TB_2P_COOP: BnetGameType.BGT_TAVERNBRAWL_2P_COOP,
GameType.GT_FSG_BRAWL_VS_FRIEND: BnetGameType.BGT_FSG_BRAWL_VS_FRIEND,
GameType.GT_FSG_BRAWL: BnetGameType.BGT_FSG_BRAWL_PVP,
GameType.GT_FSG_BRAWL_1P_VS_AI: BnetGameType.BGT_FSG_BRAWL_1P_VERSUS_AI,
GameType.GT_FSG_BRAWL_2P_COOP: BnetGameType.BGT_FSG_BRAWL_2P_COOP,
GameType.GT_BATTLEGROUNDS: BnetGameType.BGT_BATTLEGROUNDS,
# GameType.GT_LAST: BnetGameType.BGT_LAST,
}[self]
def as_bnet(self, wild=False):
if self == GameType.GT_RANKED:
return BnetGameType.BGT_RANKED_WILD if wild else BnetGameType.BGT_RANKED_STANDARD
if self == GameType.GT_CASUAL:
return BnetGameType.BGT_CASUAL_WILD if wild else BnetGameType.BGT_CASUAL_STANDARD
return {
GameType.GT_UNKNOWN: BnetGameType.BGT_UNKNOWN,
GameType.GT_VS_AI: BnetGameType.BGT_VS_AI,
GameType.GT_VS_FRIEND: BnetGameType.BGT_FRIENDS,
GameType.GT_TUTORIAL: BnetGameType.BGT_TUTORIAL,
GameType.GT_ARENA: BnetGameType.BGT_ARENA,
GameType.GT_TEST_AI_VS_AI: BnetGameType.BGT_TEST1,
GameType.GT_TAVERNBRAWL: BnetGameType.BGT_TAVERNBRAWL_PVP,
GameType.GT_TB_1P_VS_AI: BnetGameType.BGT_TAVERNBRAWL_1P_VERSUS_AI,
GameType.GT_TB_2P_COOP: BnetGameType.BGT_TAVERNBRAWL_2P_COOP,
GameType.GT_FSG_BRAWL_VS_FRIEND: BnetGameType.BGT_FSG_BRAWL_VS_FRIEND,
GameType.GT_FSG_BRAWL: BnetGameType.BGT_FSG_BRAWL_PVP,
GameType.GT_FSG_BRAWL_1P_VS_AI: BnetGameType.BGT_FSG_BRAWL_1P_VERSUS_AI,
GameType.GT_FSG_BRAWL_2P_COOP: BnetGameType.BGT_FSG_BRAWL_2P_COOP,
GameType.GT_BATTLEGROUNDS: BnetGameType.BGT_BATTLEGROUNDS,
# GameType.GT_LAST: BnetGameType.BGT_LAST,
}[self]
if self == GameType.GT_CASUAL:
return BnetGameType.BGT_CASUAL_WILD if wild else BnetGameType.BGT_CASUAL_STANDARD
return {
GameType.GT_UNKNOWN: BnetGameType.BGT_UNKNOWN,
GameType.GT_VS_AI: BnetGameType.BGT_VS_AI,
GameType.GT_VS_FRIEND: BnetGameType.BGT_FRIENDS,
GameType.GT_TUTORIAL: BnetGameType.BGT_TUTORIAL,
GameType.GT_ARENA: BnetGameType.BGT_ARENA,
GameType.GT_TEST_AI_VS_AI: BnetGameType.BGT_TEST1,
GameType.GT_TAVERNBRAWL: BnetGameType.BGT_TAVERNBRAWL_PVP,
GameType.GT_TB_1P_VS_AI: BnetGameType.BGT_TAVERNBRAWL_1P_VERSUS_AI,
GameType.GT_TB_2P_COOP: BnetGameType.BGT_TAVERNBRAWL_2P_COOP,
GameType.GT_FSG_BRAWL_VS_FRIEND: BnetGameType.BGT_FSG_BRAWL_VS_FRIEND,
GameType.GT_FSG_BRAWL: BnetGameType.BGT_FSG_BRAWL_PVP,
GameType.GT_FSG_BRAWL_1P_VS_AI: BnetGameType.BGT_FSG_BRAWL_1P_VERSUS_AI,
GameType.GT_FSG_BRAWL_2P_COOP: BnetGameType.BGT_FSG_BRAWL_2P_COOP,
GameType.GT_BATTLEGROUNDS: BnetGameType.BGT_BATTLEGROUNDS,
# GameType.GT_LAST: BnetGameType.BGT_LAST,
}[self]
def as_bnet(self, wild=False):
if self == GameType.GT_RANKED:
return BnetGameType.BGT_RANKED_WILD if wild else BnetGameType.BGT_RANKED_STANDARD
if self == GameType.GT_CASUAL:
return BnetGameType.BGT_CASUAL_WILD if wild else BnetGameType.BGT_CASUAL_STANDARD
return {
GameType.GT_UNKNOWN: BnetGameType.BGT_UNKNOWN,
GameType.GT_VS_AI: BnetGameType.BGT_VS_AI,
GameType.GT_VS_FRIEND: BnetGameType.BGT_FRIENDS,
GameType.GT_TUTORIAL: BnetGameType.BGT_TUTORIAL,
GameType.GT_ARENA: BnetGameType.BGT_ARENA,
GameType.GT_TEST_AI_VS_AI: BnetGameType.BGT_TEST1,
GameType.GT_TAVERNBRAWL: BnetGameType.BGT_TAVERNBRAWL_PVP,
GameType.GT_TB_1P_VS_AI: BnetGameType.BGT_TAVERNBRAWL_1P_VERSUS_AI,
GameType.GT_TB_2P_COOP: BnetGameType.BGT_TAVERNBRAWL_2P_COOP,
GameType.GT_FSG_BRAWL_VS_FRIEND: BnetGameType.BGT_FSG_BRAWL_VS_FRIEND,
GameType.GT_FSG_BRAWL: BnetGameType.BGT_FSG_BRAWL_PVP,
GameType.GT_FSG_BRAWL_1P_VS_AI: BnetGameType.BGT_FSG_BRAWL_1P_VERSUS_AI,
GameType.GT_FSG_BRAWL_2P_COOP: BnetGameType.BGT_FSG_BRAWL_2P_COOP,
GameType.GT_BATTLEGROUNDS: BnetGameType.BGT_BATTLEGROUNDS,
# GameType.GT_LAST: BnetGameType.BGT_LAST,
}[self]
def as_bnet(self, wild=False):
if self == GameType.GT_RANKED:
return BnetGameType.BGT_RANKED_WILD if wild else BnetGameType.BGT_RANKED_STANDARD
if self == GameType.GT_CASUAL:
return BnetGameType.BGT_CASUAL_WILD if wild else BnetGameType.BGT_CASUAL_STANDARD
return {
GameType.GT_UNKNOWN: BnetGameType.BGT_UNKNOWN,
GameType.GT_VS_AI: BnetGameType.BGT_VS_AI,
GameType.GT_VS_FRIEND: BnetGameType.BGT_FRIENDS,
GameType.GT_TUTORIAL: BnetGameType.BGT_TUTORIAL,
GameType.GT_ARENA: BnetGameType.BGT_ARENA,
GameType.GT_TEST_AI_VS_AI: BnetGameType.BGT_TEST1,
GameType.GT_TAVERNBRAWL: BnetGameType.BGT_TAVERNBRAWL_PVP,
GameType.GT_TB_1P_VS_AI: BnetGameType.BGT_TAVERNBRAWL_1P_VERSUS_AI,
GameType.GT_TB_2P_COOP: BnetGameType.BGT_TAVERNBRAWL_2P_COOP,
GameType.GT_FSG_BRAWL_VS_FRIEND: BnetGameType.BGT_FSG_BRAWL_VS_FRIEND,
GameType.GT_FSG_BRAWL: BnetGameType.BGT_FSG_BRAWL_PVP,
def as_bnet(self, wild=False):
if self == GameType.GT_RANKED:
return BnetGameType.BGT_RANKED_WILD if wild else BnetGameType.BGT_RANKED_STANDARD
if self == GameType.GT_CASUAL:
return BnetGameType.BGT_CASUAL_WILD if wild else BnetGameType.BGT_CASUAL_STANDARD
return {
GameType.GT_UNKNOWN: BnetGameType.BGT_UNKNOWN,
GameType.GT_VS_AI: BnetGameType.BGT_VS_AI,
GameType.GT_VS_FRIEND: BnetGameType.BGT_FRIENDS,
GameType.GT_TUTORIAL: BnetGameType.BGT_TUTORIAL,
GameType.GT_ARENA: BnetGameType.BGT_ARENA,
GameType.GT_TEST_AI_VS_AI: BnetGameType.BGT_TEST1,
GameType.GT_TAVERNBRAWL: BnetGameType.BGT_TAVERNBRAWL_PVP,
GameType.GT_TB_1P_VS_AI: BnetGameType.BGT_TAVERNBRAWL_1P_VERSUS_AI,
GameType.GT_TB_2P_COOP: BnetGameType.BGT_TAVERNBRAWL_2P_COOP,
GameType.GT_FSG_BRAWL_VS_FRIEND: BnetGameType.BGT_FSG_BRAWL_VS_FRIEND,
GameType.GT_FSG_BRAWL: BnetGameType.BGT_FSG_BRAWL_PVP,
GameType.GT_FSG_BRAWL_1P_VS_AI: BnetGameType.BGT_FSG_BRAWL_1P_VERSUS_AI,
GameType.GT_FSG_BRAWL_2P_COOP: BnetGameType.BGT_FSG_BRAWL_2P_COOP,
def as_bnet(self, wild=False):
if self == GameType.GT_RANKED:
return BnetGameType.BGT_RANKED_WILD if wild else BnetGameType.BGT_RANKED_STANDARD
if self == GameType.GT_CASUAL:
return BnetGameType.BGT_CASUAL_WILD if wild else BnetGameType.BGT_CASUAL_STANDARD
return {
GameType.GT_UNKNOWN: BnetGameType.BGT_UNKNOWN,
GameType.GT_VS_AI: BnetGameType.BGT_VS_AI,
GameType.GT_VS_FRIEND: BnetGameType.BGT_FRIENDS,
GameType.GT_TUTORIAL: BnetGameType.BGT_TUTORIAL,
GameType.GT_ARENA: BnetGameType.BGT_ARENA,
GameType.GT_TEST_AI_VS_AI: BnetGameType.BGT_TEST1,
GameType.GT_TAVERNBRAWL: BnetGameType.BGT_TAVERNBRAWL_PVP,
GameType.GT_TB_1P_VS_AI: BnetGameType.BGT_TAVERNBRAWL_1P_VERSUS_AI,
GameType.GT_TB_2P_COOP: BnetGameType.BGT_TAVERNBRAWL_2P_COOP,
GameType.GT_FSG_BRAWL_VS_FRIEND: BnetGameType.BGT_FSG_BRAWL_VS_FRIEND,
GameType.GT_FSG_BRAWL: BnetGameType.BGT_FSG_BRAWL_PVP,
GameType.GT_FSG_BRAWL_1P_VS_AI: BnetGameType.BGT_FSG_BRAWL_1P_VERSUS_AI,
GameType.GT_FSG_BRAWL_2P_COOP: BnetGameType.BGT_FSG_BRAWL_2P_COOP,
GameType.GT_BATTLEGROUNDS: BnetGameType.BGT_BATTLEGROUNDS,
# GameType.GT_LAST: BnetGameType.BGT_LAST,
}[self]