예제 #1
0
 def test_should_return_false_for_all_even_except_two(self):
     self.assertFalse(isPrime(600))
     self.assertTrue(isPrime(2))
     self.assertNotEqual(isPrime(2), isPrime(1000000000))
예제 #2
0
 def test_should_return_false_for_negative_number(self):
     self.assertFalse(isPrime(-3))
예제 #3
0
 def test_memoize_should_not_mutate_function(self):
     self.assertIs(self.mem(3), isPrime(3))
예제 #4
0
 def test_memoize_should_not_mutate_result(self):
     self.assertEqual(self.mem(2), isPrime(2))
예제 #5
0
 def test_should_throw_exception_if_number_is_not_integer(self):
     self.assertRaises(TypeError, isPrime(9.9999))
예제 #6
0
 def test_should_throw_type_error_if_arg_is_none(self):
     self.assertRaises(TypeError, isPrime(None))