def testFromIterator (self): self.assertEquals (List (), List.fromIterator ([])) self.assertEquals (List (1, 2, 3), List.fromIterator ((1, 2, 3))) self.assertEquals (List (0, 1, 2), List.fromIterator (xrange (3))) def gen (): for x in range (3): yield x pass pass self.assertEquals (List (0, 1, 2), List.fromIterator (gen ())) pass
def testIter (self): self.assertEquals (List (1), List.fromIterator (Just (1))) self.assertEquals (Nil, List.fromIterator (Nothing)) self.assertEquals (List (1, 2), List (Just (1), Nothing, Just (2), Nothing).flatten ()) pass