- Added location to errors on calls with missing arguments
- Improved error message on unexpected arguments in a call
- Distinguished between optional and mandatory arguments in conditions. Default argument values in conditions are accepted instead of raising a misleading "missing argument" exception.
- Added a boolyness check to detect if the condition evaluation can be negated. If the condition evaluation lacks boolyness, a more informative exception is now raised. For example, this is important for all the code operating with numpy arrays where boolyness is not given.
- Added contract location to
require
,ensure
andsnapshot
. This feature had been erroneously omitted in 2.0.4.
- Added contract location to the message of the violation error
- Fixed representation of numpy conditions
- Updated pylint to 2.3.1
- Specified
require
andensure
to use generics in order to fix typing erasure of the decorated functions
- Fixed forgotten renamings in the Readme left from icontract 1.x
- Removed
repr_args
argument to contracts since it is superseded by more versatileerror
argument - Renamed contracts to follow naming used in other languages and libraries (
require
,ensure
andinvariant
) - Improved error messages on missing arguments in the call
- Demarcated decorator and lambda inspection in
_represent
submodule
- Refactored implementation and tests into smaller modules
- Added
snapshot
decorator to capture "old" values (prior to function invocation) for postconditions that verify state transitions
- Replaced
typing.Type
withtype
so that icontract works with Python 3.5.2
- Added
error
argument to the contracts
- Removed
ast_graph
module which was only used for debugging - Prefixed internal modules with an underscore (
_represent
and_recompute
)
recompute
propagates to children of generator expressions and comprehensions- Optimized parsing of condition lambdas by considering only lines local to the decorator
- Exempted
__init__
from inheritance of preconditions and postconditions if defined in the concrete class.
- Contracts are observed and inherited with property getters, setters and deleters.
- Weakining of preconditions of a base function without any preconditions raises
TypeError
. __getattribute__
,__setattr__` and ``__delattr__
are exempted from invariants.- Slot wrappers are properly handled.
- Fixed representation of conditions with attributes in generator expressions
- Added reference to sphinx-contract
- Added reference to
pyicontract-lint
in the README - Made
inv
a class
- Added support for class and static methods
- Fixed different signatures of
DBCMeta
depending on Python version (<=3.5 and >3.5) due to differing signatures of__new__
inabc.ABCMeta
- Removed dependency on
meta
package and replaced it with re-parsing the file containing the condition to represent the comprehensions
- Quoted ellipsis in
icontract._unwind_decorator_stack
to comply with a bug in Python 3.5.2 (see python/typing#259)
- Added inheritance of contracts
- Contract's constructor immediately returns if the contract is disabled.
- Added invariants as icontract.inv
- Added
icontract.SLOW
to mark contracts which are slow and should only be enabled during development - Added
enabled
flag to toggle contracts for development, production __etc.__
- Removed
version.txt
that caused problems withsetup.py
- Fixed: the
result
is passed to the postcondition only if necessary
- Fixed a bug that fetched the unexpected frame when conditions were stacked
- Fixed a bug that prevented default function values propagating to the condition function
- Added reprlib.Repr as an additional parameter to customize representation
- Fixed unit tests to set actual and expected arguments correctly
- Made ViolationError an AssertionError
- Added representation of values by re-executing the abstract syntax tree of the function
pre
andpost
decorators usefunctools.update_wrapper
to allow for doctests
- Moved icontract.py to a module directory
- Added py.typed to comply with mypy
- Fixed links in the README and setup.py
- Initial version