Whole file

hamcrest/PyHamcrest

The author described this change as No newline in raises() with pattern mismatch desc.. It counts as a record because the check below fails on the code as it stood at eb746246a and passes on 1380aedaf, with nothing else changed between the two runs.

Fix saved2020-01-07
Sharing licenceBSD-3-Clause · LICENSE.txt
Change size+7 6

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

No newline in raises() with pattern mismatch desc.

The change

5555
5656 if self.actual is None:
5757 description.append_text("No exception raised.")
58- elif isinstance(self.actual, cast(type, self.expected)) and self.pattern is not None:
59- description.append_text(
60- 'Correct assertion type raised, but the expected pattern ("%s") not found.'
61- % self.pattern
62- )
63- description.append_text('\n message was: "%s"' % str(self.actual))
58+ elif isinstance(self.actual, cast(type, self.expected)):
59+ if self.pattern is not None:
60+ description.append_text(
61+ 'Correct assertion type raised, but the expected pattern ("%s") not found. '
62+ % self.pattern
63+ )
64+ description.append_text('Exception message was: "%s"' % str(self.actual))
6465 else:
6566 description.append_text(
6667 "%r of type %s was raised instead" % (self.actual, type(self.actual))

The check that tells the two apart

failpass·tests/hamcrest_unit_test/core/raises_test.py::RaisesTest::testDoesNotMatchExceptionIfRegularExpressionDoesNotMatch

Check file tests/hamcrest_unit_test/core/raises_test.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 iteb746246a13c4abd6141c6ab45724ec1c4a2efbe
Broken version dated2020-01-02
Modulehamcrest.core.core.raises
Units changedRaises
Fingerprintba2a3e685b117cd7
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 hamcrest/PyHamcrest