def test_ok(self): def func(a, b, c, d=None): assert a == 1 and b == 2 assert c == 3 and d == 4 return 5 ret = impl.safe(func, (1, 2), dict(c=3, d=4), error="message") assert ret == 5
def test_bad_args(self): def func(arg): pass ret = impl.safe(func, default=6, error="message") assert ret == 6