Пример #1
0
    def test_none (self):
        # no args
        assert _none(istrue)()
        assert _none(isfalse)()
        assert _none(truth)()
        assert _none(not_)()
        assert _none(isempty)()

        # single arg
        assert _none(istrue)(False)
        assert _none(isstring)(42)
        assert not _none(isfalse)(False)

        # multiple args
        assert _none(istrue)(False, 42)
        assert _none(isstring)(23, 42)
        assert not _none(isfalse)(0, True, False)
        assert not _none(isstring)((), "bad robot!")
Пример #2
0
 def test_short_circuit (self):
     assert _any(passfail)(True, 'fail')
     assert not _all(passfail)(False, 'fail')
     assert not _none(passfail)(True, 'fail')