From 974c8c097b63b37caab141ec04c3ab3322e615ef Mon Sep 17 00:00:00 2001 From: Jakob Cornell Date: Sun, 20 Nov 2022 16:58:26 -0600 Subject: [PATCH] Fix Strikebot number parsing bug (mixed separators accepted) --- strikebot/setup.cfg | 2 +- strikebot/src/strikebot/tests.py | 5 +++++ strikebot/src/strikebot/updates.py | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) 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 -- 2.30.2