Esempio n. 1
0
 def test_exponential_base_sequence(self):
     """
     Ensure that an exponential sequence with a different base works.
     """
     sequence = ExponentialSequence(base=10)
     for idx in xrange(1, 1000):
         self.assertEqual(sequence.next(), 10**idx)
Esempio n. 2
0
 def test_exponential_unit_sequence(self):
     """
     Ensure an "infinite" exponential sequence works as expected.
     """
     sequence = ExponentialSequence()
     for idx in xrange(1, 1000):
         self.assertEqual(sequence.next(), 2**idx)
Esempio n. 3
0
 def test_exponential_base_sequence(self):
     """
     Ensure that an exponential sequence with a different base works.
     """
     sequence = ExponentialSequence(base=10)
     for idx in xrange(1, 1000):
         self.assertEqual(sequence.next(), 10**idx)
Esempio n. 4
0
 def test_exponential_unit_sequence(self):
     """
     Ensure an "infinite" exponential sequence works as expected.
     """
     sequence = ExponentialSequence()
     for idx in xrange(1, 1000):
         self.assertEqual(sequence.next(), 2**idx)
Esempio n. 5
0
 def test_exponential_limit_sequence(self):
     """
     Ensure that a sequence can be limited.
     """
     with self.assertRaises(StopIteration):
         sequence = ExponentialSequence(limit=1000)
         for idx in xrange(1, 100000):
             self.assertEqual(sequence.next(), 2**idx)
Esempio n. 6
0
 def test_exponential_limit_sequence(self):
     """
     Ensure that a sequence can be limited.
     """
     with self.assertRaises(StopIteration):
         sequence = ExponentialSequence(limit=1000)
         for idx in xrange(1, 100000):
             self.assertEqual(sequence.next(), 2**idx)