class Test def main .testNumberedP1 .testNumberedP2 .testNumberedKVP def numberedP1 as Pair* yield Pair(0, 1) yield Pair(1, 2) def numberedP2 as Pair* yield Pair(0, 'a') yield Pair(1, 'b') def numberedKVP as KeyValuePair* yield KeyValuePair(0, 'a') yield KeyValuePair(1, 'b') def testNumberedP1 count = 0 for i, j in .numberedP1 assert i in [0, 1] assert j in [0, 1, 2] assert (i==0 and j==1) or (i==1 and j==2) count += 1 assert count == 2 def testNumberedP2 count = 0 for i, s in .numberedP2 assert i in [0, 1] assert s in ['a', 'b'] assert (i==0 and s=='a') or (i==1 and s=='b') count += 1 assert count == 2 def testNumberedKVP count = 0 for i, s in .numberedKVP assert i in [0, 1] assert s in ['a', 'b'] assert (i==0 and s=='a') or (i==1 and s=='b') count += 1 assert count == 2