class TestAllAny def main is shared # lists t = [1, 2, 3] assert all t assert any t t.add(0) assert not all t assert any t t = [0] assert not all t assert not any t t.clear assert all t assert not any t # sets s = {1, 2, 3} assert all s assert any s s.add(0) assert not all s assert any s s = {0} assert not all s assert not any s s.clear assert all s assert not any s # complex expressions assert all [1, 2] assert any [0, 1] assert all for x in [0, 1] get x + 1 assert any for x in {0, 1} get x + 1 # enumerable assert all .evens assert any .evens def evens as IEnumerable is shared yield 2 yield 4 yield 8