Ejemplo n.º 1
0
    def test_it_should_count_the_number_of_occurrences_in_the_stream(self):
        stream = Stream(xrange(100))
        stream = stream.limit(50)
        self.assertEqual(stream.count(), 50)

        stream = Stream(xrange(100))
        stream = stream.limit(1000)
        self.assertEqual(stream.count(), 100)
Ejemplo n.º 2
0
    def test_limit(self):
        stream = Stream(xrange(100))
        stream = stream.limit(50)
        self.assertEqual(stream.count(), 50)

        stream = Stream(xrange(100))
        stream = stream.limit(1000)
        self.assertEqual(stream.count(), 100)
Ejemplo n.º 3
0
    def test_it_should_count_the_number_of_occurrences_in_the_stream(self):
        stream = Stream(xrange(100))
        stream = stream.limit(50)
        self.assertEqual(stream.count(), 50)

        stream = Stream(xrange(100))
        stream = stream.limit(1000)
        self.assertEqual(stream.count(), 100)
Ejemplo n.º 4
0
    def test_divisibleby(self):
        stream = Stream(xrange(2000))
        stream = stream.ints().divisible_by(10)
        self.assertEqual(stream.count(), 200)

        stream = Stream(xrange(2000))
        stream = stream.divisible_by(1000)
        self.assertEquals(list(stream), [0, 1000])
Ejemplo n.º 5
0
    def test_it_should_filter_by_divisibility(self):
        stream = Stream(range(6))
        stream = stream.divisible_by(2)
        self.assertListEqual(list(stream), [0, 2, 4])

        stream = Stream(xrange(2000))
        stream = stream.ints().divisible_by(10)
        self.assertEqual(stream.count(), 200)

        stream = Stream(xrange(2000))
        stream = stream.divisible_by(1000)
        self.assertEquals(list(stream), [0, 1000])
Ejemplo n.º 6
0
    def test_it_should_filter_by_divisibility(self):
        stream = Stream(range(6))
        stream = stream.divisible_by(2)
        self.assertListEqual(list(stream), [0, 2, 4])

        stream = Stream(xrange(2000))
        stream = stream.ints().divisible_by(10)
        self.assertEqual(stream.count(), 200)

        stream = Stream(xrange(2000))
        stream = stream.divisible_by(1000)
        self.assertEquals(list(stream), [0, 1000])
Ejemplo n.º 7
0
 def test_first(self):
     stream = Stream(xrange(10))
     self.assertEqual(stream.first, 0)
     self.assertEqual(stream.first, 0)
     self.assertEqual(stream.first, 0)
     self.assertEqual(stream.count(), 10)