Skip to content
Snippets Groups Projects
Commit a58f8337 authored by Piotr Maślanka's avatar Piotr Maślanka
Browse files

unit test for precondition

parent 247e083a
No related branches found
No related tags found
No related merge requests found
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
* more docs * more docs
* fixed `MemoryErrorExceptionHandler` not being importable from `satella.exception_handling` * fixed `MemoryErrorExceptionHandler` not being importable from `satella.exception_handling`
* fixed the custom_hook for `MemoryErrorExceptionHandler`: it won't * fixed the custom_hook for `MemoryErrorExceptionHandler`: it won't
kill everything if the custom_hook returns True kill everything if the custom_hook returns True
* added an unit test for `precondition`
# v2.2.1 # v2.2.1
......
# coding=UTF-8 # coding=UTF-8
__version__ = '2.2.2a5' __version__ = '2.2.2a6'
...@@ -17,6 +17,13 @@ class TestTypecheck(unittest.TestCase): ...@@ -17,6 +17,13 @@ class TestTypecheck(unittest.TestCase):
self.assertRaises(PreconditionError, lambda: return_double([1], 2, 5)) self.assertRaises(PreconditionError, lambda: return_double([1], 2, 5))
return_double([1], 1, 'dupa') return_double([1], 1, 'dupa')
def test_precondition_fail(self):
@precondition('len(x) == 1', lambda x: x == 1, None, None, None)
def return_double(x, y, z):
pass
self.assertRaises(AssertionError, lambda: return_double([1], 1, 5))
def test_forarg_kwords(self): def test_forarg_kwords(self):
@for_argument(int, typed=bool) @for_argument(int, typed=bool)
def check(v1, typed='True'): def check(v1, typed='True'):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment