Esempio n. 1
0
    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
Esempio n. 2
0
    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
Esempio n. 3
0
    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
Esempio n. 4
0
    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
Esempio n. 5
0
    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
Esempio n. 6
0
 def test_any_nop(self):
     with must_be_called(3) as nop:
         assert Any(nop, nop, nop)('fnord') is None
Esempio n. 7
0
    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
Esempio n. 8
0
 def test_first_nop(self):
     with must_be_called(3) as nop:
         assert First(nop, nop, nop)('fnord') is None
Esempio n. 9
0
	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
Esempio n. 10
0
 def test_acl_fallthrough(self):
     with must_be_called(1) as nop:
         acl = ACL(nop)
         assert acl.is_authorized.result is None
Esempio n. 11
0
 def test_acl_skip(self):
     with must_be_called(1) as nop:
         acl = ACL(nop, always)
         assert acl.is_authorized.result is True