def test_or (self): # no predicates assert not _or()(True) # single predicate assert _or(isempty)('') assert _or(not_)(0) assert not _or(isfalse)(True) assert not _or(istrue)(False) # multiple predicates assert _or(isempty, not_)(0) assert _or(isfalse, isstring)('') assert not _or(isfalse, isstring)(True)
def test_short_circuit (self): assert not _and(false, fail)() assert _or(true, fail)() assert not _not(true, fail)()
def test_composition (self): assert _all(_or(isempty, isatom))('', (), 42) assert not _all(_or(isempty, isatom))('', (), (42,))
def test_composition (self): assert not _and(_not(isstring), _or(isempty, isatom))('') assert _and(_not(isstring), _or(isempty, isatom))(()) assert _and(_not(isstring), _or(isempty, isatom))(42)