예제 #1
0
 def test3_large_positive_random_integers(self, x):
     """Randomly picked integers in the range [0, 1 000 000]."""
     if model_is_prime(x):
         self.assertTrue(
             is_prime(x),
             "{} is a prime number but your function says it is not.".
             format(x))
     else:
         self.assertFalse(
             is_prime(x),
             "{} is not a prime number but your function says it is.".
             format(x))
예제 #2
0
    def test_is__prime_with_large_set(self, i):
        """is_prime returns True for prime numbers and False for non-prime numbers for 1000 random positive integers in range(0, 10**6)."""

        if model_is_prime(i):
            self.assertTrue(
                is_prime(i),
                "{} is a prime number but your function says it is not.".
                format(i))
        else:
            self.assertFalse(
                is_prime(i),
                "{} is not a prime number but your function says it is.".
                format(i))
예제 #3
0
 def test2_small_positive_integers(self):
     """Integers in the range [100, 200]."""
     for x in range(100, 201):
         if model_is_prime(x):
             self.assertTrue(
                 is_prime(x),
                 "{} is a prime number but your function says it is not.".
                 format(x))
         else:
             self.assertFalse(
                 is_prime(x),
                 "{} is not a prime number but your function says it is.".
                 format(x))
예제 #4
0
 def test_is__prime_with_small_set(self):
     """is_prime returns True for prime numbers and False for non-prime numbers in range [100, 200]"""
     for i in range(100, 201):
         if model_is_prime(i):
             self.assertTrue(
                 is_prime(i),
                 "{} is a prime number but your function says it is not.".
                 format(i))
         else:
             self.assertFalse(
                 is_prime(i),
                 "{} is not a prime number but your function says it is.".
                 format(i))