示例#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))