Example #1
0
 def test_first_four_primes(self):
     """Test a middle case, four primes
     """
     self.assertEqual(primes.first_n_primes(4), [2, 3, 5, 7])
Example #2
0
 def test_only_one_prime(self):
     """Test the corner case where only the first prime (2) is requested
     """
     self.assertEqual(primes.first_n_primes(1), [2])
Example #3
0
 def test_first_three_primes(self):
     """Test the corner case where only the two frist primes are requested
     """
     self.assertEqual(primes.first_n_primes(3), [2, 3, 5])
Example #4
0
    def test_first_10_primes(self):
        """Test an easy case: calculate the first ten primes.
        """
        ten_primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29]

        self.assertEqual(primes.first_n_primes(10), ten_primes)