예제 #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
예제 #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
예제 #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
예제 #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
예제 #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
예제 #6
0
 def test_any_nop(self):
     with must_be_called(3) as nop:
         assert Any(nop, nop, nop)('fnord') is None
예제 #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
예제 #8
0
 def test_first_nop(self):
     with must_be_called(3) as nop:
         assert First(nop, nop, nop)('fnord') is None
예제 #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
예제 #10
0
 def test_acl_fallthrough(self):
     with must_be_called(1) as nop:
         acl = ACL(nop)
         assert acl.is_authorized.result is None
예제 #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