aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar MarkKoz <[email protected]>2020-05-25 21:02:24 -0700
committerGravatar MarkKoz <[email protected]>2020-05-25 21:02:24 -0700
commita8a216d0803b67a330ae092a17bea563f5012275 (patch)
tree4d014495a1204d566b192de341315d24f2e24a34
parentAdd more valid tokens to test the regex with (diff)
Fix valid token regex test
It was broken due to the addition of groups. Rather than returning the full match, `findall` returns groups if any exist. The test was comparing a tuple of groups to the token string, which was of course failing. Now `fullmatch` is used cause it's simpler - just check for `None` and don't worry about iterating matches to search.
-rw-r--r--tests/bot/cogs/test_token_remover.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/bot/cogs/test_token_remover.py b/tests/bot/cogs/test_token_remover.py
index 6a280f358..518bf91ca 100644
--- a/tests/bot/cogs/test_token_remover.py
+++ b/tests/bot/cogs/test_token_remover.py
@@ -166,8 +166,8 @@ class TokenRemoverTests(unittest.IsolatedAsyncioTestCase):
for token in tokens:
with self.subTest(token=token):
- results = token_remover.TOKEN_RE.findall(token)
- self.assertIn(token, results)
+ results = token_remover.TOKEN_RE.fullmatch(token)
+ self.assertIsNotNone(results, f"{token} was not matched by the regex")
def test_regex_matches_multiple_valid(self):
"""Should support multiple matches in the middle of a string."""