def test_sequence(self):
     generator = consumer(sequence())
     self.assertEqual(generator(), 1)
     self.assertEqual(generator(), 2)
     self.assertEqual(generator(), 3)
     self.assertEqual(generator(), 4)
     self.assertEqual(generator(), 5)
     self.assertEqual(generator(), 6)
Beispiel #2
0
 def test_sequence(self):
     generator = consumer(sequence())
     self.assertEqual(generator(), 1)
     self.assertEqual(generator(), 2)
     self.assertEqual(generator(), 3)
     self.assertEqual(generator(), 4)
     self.assertEqual(generator(), 5)
     self.assertEqual(generator(), 6)
 def test_sequence_incr(self):
     generator = consumer(sequence(start=5, incr=-5))
     self.assertEqual(generator(), 5)
     self.assertEqual(generator(), 0)
     self.assertEqual(generator(), -5)
 def test_sequence_start(self):
     generator = consumer(sequence(start=5))
     self.assertEqual(generator(), 5)
     self.assertEqual(generator(), 6)
     self.assertEqual(generator(), 7)
     self.assertEqual(generator(), 8)
    def test_consumer_error(self):
        generator = consumer([1])
        self.assertEqual(generator(), 1)

        self.assertRaises(StopIteration, generator)
 def test_consumer(self):
     generator = consumer([1, 2, 3])
     self.assertEqual(generator(), 1)
     self.assertEqual(generator(), 2)
     self.assertEqual(generator(), 3)
Beispiel #7
0
 def test_sequence_incr(self):
     generator = consumer(sequence(start=5, incr=-5))
     self.assertEqual(generator(), 5)
     self.assertEqual(generator(), 0)
     self.assertEqual(generator(), -5)
Beispiel #8
0
 def test_sequence_start(self):
     generator = consumer(sequence(start=5))
     self.assertEqual(generator(), 5)
     self.assertEqual(generator(), 6)
     self.assertEqual(generator(), 7)
     self.assertEqual(generator(), 8)
Beispiel #9
0
    def test_consumer_error(self):
        generator = consumer([1])
        self.assertEqual(generator(), 1)

        self.assertRaises(StopIteration, generator)
Beispiel #10
0
 def test_consumer(self):
     generator = consumer([1, 2, 3])
     self.assertEqual(generator(), 1)
     self.assertEqual(generator(), 2)
     self.assertEqual(generator(), 3)