Whole file

careless25/text2digits

The author described this change as Raise valueError if value/scale didnt match. It counts as a record because the checks below fail on the code as it stood at 4cfa43d58 and pass on 56b6b8b86, with nothing else changed between the two runs.

Fix saved2026-04-28
Sharing licenceMIT · LICENSE
Change size+2 0

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

Raise valueError if value/scale didnt match

The change

115115 return Decimal(self._word)
116116 elif self.type != WordType.OTHER:
117117 return Decimal(Token.numwords[self._word][1])
118+ raise ValueError(f"Cannot compute value for token of type {self.type!r} (word={self.word_raw!r})")
118119
119120 def scale(self) -> Decimal:
120121 """
127128 return Decimal(1)
128129 elif self.type != WordType.OTHER:
129130 return Decimal(Token.numwords[self._word][0])
131+ raise ValueError(f"Cannot compute scale for token of type {self.type!r} (word={self.word_raw!r})")
130132
131133 def text(self) -> str:
132134 """

The check that tells the two apart

failpass·tests/test_tokens.py::TestOtherTokenValueScale::test_error_message_includes_word
failpass·tests/test_tokens.py::TestOtherTokenValueScale::test_scale_raises_for_other
failpass·tests/test_tokens.py::TestOtherTokenValueScale::test_value_raises_for_other

Check file tests/test_tokens.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 it4cfa43d589ebe3377a3112b633006614c15e7f94
Broken version dated2026-04-28
Moduletext2digits.tokens_basic
Units changedToken
Fingerprint39862d57600e13bc
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