Whole file
assertpy/assertpy
The author described this change as “fixes #70 - raises() assertion supports any callable”. It counts as a record because the check below fails on the code as it stood at b02493f6c and passes on 6ce4d79f6, with nothing else changed between the two runs.
Projectassertpy/assertpy
Fix saved2017-11-16
Sharing licenceBSD-3-Clause · LICENSE
Change size+3 −3
What the code was meant to do, written into the code itself as a save note
fixes #70 - raises() assertion supports any callable
The change
| 971 | 971 | ||
| 972 | 972 | ### expected exceptions ### | |
| 973 | 973 | def raises(self, ex): | |
| 974 | - | """Asserts that val is a function that when invoked raises the given error.""" | |
| 975 | - | if not inspect.isfunction(self.val): | |
| 976 | - | raise TypeError('val must be function') | |
| 974 | + | """Asserts that val is callable that when called raises the given error.""" | |
| 975 | + | if not callable(self.val): | |
| 976 | + | raise TypeError('val must be callable') | |
| 977 | 977 | if not issubclass(ex, BaseException): | |
| 978 | 978 | raise TypeError('given arg must be exception') | |
| 979 | 979 | return AssertionBuilder(self.val, self.description, self.kind, ex) |
The check that tells the two apart
fail→pass·tests/test_expected_exception.py::test_expected_exception_method
Check file tests/test_expected_exception.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 itb02493f6c35a7130b34a26251425494d933e20aa
Broken version dated2017-11-09
Moduleassertpy.assertpy
Units changedAssertionBuilder
Fingerprinte6cf57162bde325b
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.