[2.4.0] - 2022-12-21
Enhancements
unnecessary_indexing_checker
has now been extended to check comprehensions in addition to for loops.invalid_for_target_checker
has now been extended to check comprehensions in addition to for loops.forbidden_io_function_checker
is now able to check for calls to IO functions written at the top-level of a module, but outside the main block.python_ta.debug.AccumulationTable
is extended to support printing loop iterations for while loops.- Violated representation invariant error message now includes the class name and current values of the instance attributes.
- Added constant
python_ta.contracts.ENABLE_CONTRACT_CHECKING
to only check contracts when its value is set toTrue
. python_ta.debug.AccumulationTable
has extended loop detection to allow the loop to appear anywhere inside the with statement.
Bug Fixes
- Fixed Issue #831: Contract Checker Bug. Now raises
AssertionError
when the expected type isfloat
but gotint
instead. - PyTA contracts' type checking now raises
AssertionError
when the expected type isint
but gotbool
instead. - Fixed PyTA contract checking when running modules in PyCharm using the "Run File in Python Console" action.
New checkers
Custom checkers:
forbidden-top-level-code
: Flag code written at the top level when it is not one of the four acceptable types.