From: Jakob Cornell Date: Sun, 20 Nov 2022 22:58:26 +0000 (-0600) Subject: Fix Strikebot number parsing bug (mixed separators accepted) X-Git-Tag: strikebot-0.0.7 X-Git-Url: https://jcornell.net/gitweb/gitweb.cgi?a=commitdiff_plain;h=7955f69cd55f1c642bacc798dd27b6f3ba149164;p=counting.git Fix Strikebot number parsing bug (mixed separators accepted) --- diff --git a/strikebot/setup.cfg b/strikebot/setup.cfg index b3efa42..cdd2e66 100644 --- a/strikebot/setup.cfg +++ b/strikebot/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = strikebot -version = 0.0.6 +version = 0.0.7 [options] package_dir = diff --git a/strikebot/src/strikebot/tests.py b/strikebot/src/strikebot/tests.py index d081e12..966bca6 100644 --- a/strikebot/src/strikebot/tests.py +++ b/strikebot/src/strikebot/tests.py @@ -49,6 +49,11 @@ class UpdateParsingTests(TestCase): self.assertIsNone(pu.number) self.assertTrue(pu.count_attempt) + # this update is marked non-deletable, but I'm not sure it should be + pu = parse_update(_build_payload("12,123123"), 12_123_123, "") + self.assertIsNone(pu.number) + self.assertTrue(pu.count_attempt) + def test_html_handling(self): pu = parse_update(_build_payload("123
,456"), None, "") self.assertEqual(pu.number, 123) diff --git a/strikebot/src/strikebot/updates.py b/strikebot/src/strikebot/updates.py index 2ecf1d7..01eb67b 100644 --- a/strikebot/src/strikebot/updates.py +++ b/strikebot/src/strikebot/updates.py @@ -182,6 +182,7 @@ def _parse_from_lines(lines: list[str], curr_count: Optional[int], bot_user: str else: count_attempt = True else: + number = None count_attempt = True deletable = False