def test_recursive_iter_basics(self): self.assertEquals(list(transformations.recursive_iter(1)), [1]) self.assertEquals(list(transformations.recursive_iter('a')), ['a']) self.assertEquals(list(transformations.recursive_iter('abc')), ['abc']) self.assertEquals(list(transformations.recursive_iter(['abc', 'def'])), ['abc', 'def']) self.assertEquals(list(transformations.recursive_iter(('abc', 'def'))), ['abc', 'def']) self.assertEquals(list(transformations.recursive_iter((e for e in [1,2]))), [1, 2]) self.assertEquals(list(transformations.recursive_iter(set(['abc', 'def']))), ['abc', 'def']) self.assertEquals(list(transformations.recursive_iter(FakeIterable([1, 2]))), [1, 2])
def test_recursive_iter_nested(self): self.assertEquals(list(transformations.recursive_iter([[1]])), [1]) self.assertEquals(list(transformations.recursive_iter([['a']])), ['a']) self.assertEquals(list(transformations.recursive_iter([['abc']])), ['abc']) self.assertEquals(list(transformations.recursive_iter([['abc', 'def']])), ['abc', 'def']) self.assertEquals(list(transformations.recursive_iter([['abc'], ['def']])), ['abc', 'def']) self.assertEquals(list(transformations.recursive_iter([['abc'], 'def'])), ['abc', 'def']) self.assertEquals(list(transformations.recursive_iter((set(['abc']), ('def',)))), ['abc', 'def']) self.assertEquals(list(transformations.recursive_iter([1, FakeIterable([2])])), [1, 2])