Skip to content

Commit

Permalink
Formatting, improve GG check
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelseeger committed Jul 23, 2024
1 parent 9190fb1 commit d63e21f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
3 changes: 2 additions & 1 deletion replays/sc2readerplugins/statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ def loserDoesGG(replay):
loser_sids = [p.sid for p in replay.players if p.result == "Loss"]
loser_messages = [m for m in replay.messages if m.pid in loser_sids]
return any(
levenshtein(m.text.lower(), g) < 2 and m.text.lower() != "bg"
set((m.text.lower())) - set("g") == set()
or (levenshtein(m.text.lower(), g) < 2 and m.text.lower() != "bg")
for g in GGS
for m in loser_messages
)
2 changes: 0 additions & 2 deletions tests/integration/test_obs_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,3 @@ def test_sc2client_get_opponent():
print(f"Is barcode: {barcode}")

assert opponent is not None


24 changes: 18 additions & 6 deletions tests/unit/test_sc2client.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
from config import config
from obs_tools.sc2client import SC2Client
from obs_tools.types import GameInfo, Screen, UIInfo
from obs_tools.types import Screen, UIInfo


def test_uiinfo_equality_loading():
Expand All @@ -11,7 +9,21 @@ def test_uiinfo_equality_loading():


def test_uiinfo_equality_menus():
ui1 = UIInfo(activeScreens=[Screen.background, Screen.foreground, Screen.navigation, Screen.home ])
ui2 = UIInfo(activeScreens=[Screen.home, Screen.background, Screen.foreground, Screen.navigation])
ui1 = UIInfo(
activeScreens=[
Screen.background,
Screen.foreground,
Screen.navigation,
Screen.home,
]
)
ui2 = UIInfo(
activeScreens=[
Screen.home,
Screen.background,
Screen.foreground,
Screen.navigation,
]
)

assert ui1 == ui2
assert ui1 == ui2

0 comments on commit d63e21f

Please sign in to comment.