Whole file

careless25/text2digits

The author described this change as Fix handling of time formats, add tests (from PR #27). It counts as a record because the check below fails on the code as it stood at ceba3d954 and passes on 0ddb34121, with nothing else changed between the two runs.

Fix saved2020-04-29
Sharing licenceMIT · LICENSE
Change size+2 2

What the code was meant to do, written into the code itself as a save note

Fix handling of time formats, add tests (from PR #27)

The change

7676 self.type = WordType.SCALES
7777 elif self._word in Token.CONJUNCTION:
7878 self.type = WordType.CONJUNCTION
79- elif re.search(r'\d+\.\d*|\d*\.\d+', self._word):
79+ elif re.search(r'^\d+\.\d*|\d*\.\d+$', self._word):
8080 self.type = WordType.LITERAL_FLOAT
81- elif re.search(r'\d+', self._word):
81+ elif re.search(r'^\d+$', self._word):
8282 self.type = WordType.LITERAL_INT
8383 else:
8484 self.type = WordType.OTHER

The check that tells the two apart

failpass·tests/test_number_conversion.py::test_time_formats[at

Check file tests/test_number_conversion.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.

Origin and history

The code before itceba3d954fc923cf7b14906194e232a42eb53636
Broken version dated2020-04-27
Moduletext2digits.tokens_basic
Units changedToken
Fingerprintd25e0f42f33a8d25
Checked2026-08-18 by goldset/0.1

Every field above is generated by our program. None of it is written by hand.

Other bugs found in careless25/text2digits