from unittest import TestCase

from preconditions import PreconditionError, preconditions


class InvalidPreconditionTests (TestCase):
    def test_varargs_in_precondition(self):
        self.assertRaises(PreconditionError, preconditions, lambda *a: a)

@@ -152,102 +152,852 @@
 args
-_in_precondition(self):%0A        self.assertRaises(PreconditionError, preconditions, lambda *a: a
+(self):%0A        self.assertRaises(PreconditionError, preconditions, lambda *a: True)%0A%0A    def test_kwargs(self):%0A        self.assertRaises(PreconditionError, preconditions, lambda **kw: True)%0A%0A    def test_unknown_nondefault_param(self):%0A        # The preconditions refer to %22x%22 but are applied to %22a, b%22, so%0A        # %22x%22 is unknown:%0A        p = preconditions(lambda x: True)%0A%0A        self.assertRaises(PreconditionError, p, lambda a, b: a+b)%0A%0A    def test_default_masks_param(self):%0A        # Preconditions may have defaults as a hack to bind local%0A        # variables (such as when declared syntactically inside loops),%0A        # but this %22closure hack%22 must not mask application function%0A        # parameter names:%0A        p = preconditions(lambda a, b='a stored value': True)%0A%0A        self.assertRaises(PreconditionError, p, lambda a, b: a+b
 )%0A

Add tests for other precondition definition errors.