def test_any_falsy(self): assert Any(never, never, never)() is False with must_be_called(2) as nop: assert Any(never, nop, nop)() is False with must_be_called(2) as nop: assert Any(nop, nop, never)() is False
def test_first_falsy(self): assert First(never, never, never)() is False with must_be_called(2) as nop: assert First(nop, nop, never)() is False with must_not_be_called() as canary: assert First(never, canary, canary)() is False
def test_first_truthy(self): assert First(always, always, always)() is True with must_be_called(2) as nop: assert First(nop, nop, always)() is True with must_not_be_called() as canary: assert First(always, canary, canary)() is True
def test_any_truthy(self): assert Any(always, always, always)() is True with must_not_be_called() as canary: assert Any(always, canary, canary)() is True with must_not_be_called() as canary: with must_be_called(1) as nop: assert Any(nop, always, canary)() is True
def test_all_falsy(self): assert All(always, never, always)() is False with must_not_be_called() as canary: assert All(never, canary, canary)() is False with must_not_be_called() as canary: with must_be_called(1) as nop: assert All(nop, never, canary)() is False with must_not_be_called() as canary: assert All(always, never, canary)() is False with must_be_called(2) as nop: assert All(nop, nop, never)() is False with must_not_be_called() as canary: assert All(always, never, canary)() is False
def test_any_nop(self): with must_be_called(3) as nop: assert Any(nop, nop, nop)('fnord') is None
def test_all_truthy(self): assert All(always, always, always)() is True with must_be_called(2) as nop: assert All(always, nop, nop)() is True
def test_first_nop(self): with must_be_called(3) as nop: assert First(nop, nop, nop)('fnord') is None
def test_not(self): assert Not(always)() is False assert Not(never)() is True with must_be_called(1) as nop: assert Not(nop)(27) is None
def test_acl_fallthrough(self): with must_be_called(1) as nop: acl = ACL(nop) assert acl.is_authorized.result is None
def test_acl_skip(self): with must_be_called(1) as nop: acl = ACL(nop, always) assert acl.is_authorized.result is True