Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@icontract.snapshot(lambda lst: len(lst), name='len_lst')
@icontract.post(lambda OLD, val, a_list: OLD.len_lst + 1 == len(a_list))
def some_func(a_list: List[int], val: int) -> None:
a_list.append(val)
@icontract.snapshot(lambda lst: len(lst), name="len_lst")
@icontract.ensure(lambda OLD, val, lst: OLD.len_lst + 1 == len(lst))
def some_func(lst: List[int], val: int) -> None:
lst.append(val)
lst.append(1984)
@icontract.snapshot(lambda lst: lst[:])
@icontract.post(lambda OLD, val, lst: OLD.lst + [val] == lst)
def some_func(lst: List[int], val: int) -> None:
lst.append(val)
lst.append(1984)
@icontract.snapshot(lambda self: self.dels, name="dels")
@icontract.ensure(lambda OLD, self: self.dels == OLD.dels + 1)
def some_prop(self) -> None:
# no self.dels increment
return
@icontract.snapshot(lambda self: self.gets, name="gets")
@icontract.post(lambda OLD, self: self.gets == OLD.gets + 1)
def some_prop(self) -> int:
return 0
@icontract.snapshot(lambda self: self.dels, name="dels")
@icontract.post(lambda OLD, self: self.sets == OLD.dels + 1)
def some_prop(self) -> None:
self.dels += 1
return
@icontract.snapshot(lambda: z[:], name="z")
@icontract.ensure(lambda OLD, val: OLD.z + [val] == z)
def some_func(val: int) -> None:
z.append(val)
@icontract.snapshot(lambda self: self.dels, name="dels")
@icontract.ensure(lambda OLD, self: self.dels == OLD.dels + 1)
def some_prop(self) -> None:
self.dels += 1
@icontract.snapshot(lambda a: a[:])
@icontract.post(lambda OLD, a: a == OLD.a)
def some_function(a: List[int], OLD: int) -> None: # pylint: disable=unused-variable
pass
@icontract.snapshot(lambda lst: lst[:])
@icontract.ensure(lambda OLD, val, lst: OLD.lst + [val] == lst)
def some_func(lst: List[int], val: int) -> None:
lst.append(val)