Ejemplo n.º 1
0
    def test_it_should_map_a_function_to_the_stream(self):
        stream = Stream(range(10))
        stream = stream.map(lambda item: -item)
        self.assertEqual(max(stream), 0)

        stream = Stream(dict((v, v) for v in xrange(100)))
        stream = stream.values().skip(10).limit(3)
        self.assertListEqual(list(stream), [10, 11, 12])
Ejemplo n.º 2
0
    def test_it_should_map_a_function_to_the_stream(self):
        stream = Stream(range(10))
        stream = stream.map(lambda item: -item)
        self.assertEqual(max(stream), 0)

        stream = Stream(dict((v, v) for v in xrange(100)))
        stream = stream.values().skip(10).limit(3)
        self.assertListEqual(list(stream), [10, 11, 12])
Ejemplo n.º 3
0
 def test_it_should_include_only_values(self):
     stream = Stream(list(zip(range(10), range(100, 110),
                              range(20, 30))) + ['foo'])
     values = stream.values()
     self.assertListEqual(list(values), list(range(20, 30)) + ['foo'])
Ejemplo n.º 4
0
 def test_it_should_include_only_values(self):
     stream = Stream(
         list(zip(range(10), range(100, 110), range(20, 30))) + ['foo'])
     values = stream.values()
     self.assertListEqual(list(values), list(range(20, 30)) + ['foo'])