def test_with_two(self):
     self.assertEqual(prime_generator(2), [2])
 def test_numbers_less_than_two(self):
     self.assertEqual(prime_generator(0),
                      "The number has to be greater than 1")
 def test_with_one(self):
     self.assertEqual(prime_generator(1),
                      "The number has to be greater than 1")
 def test_list_argument(self):
     with self.assertRaises(TypeError):
         prime_generator([2, 5, 7])
 def test_negative_numbers(self):
     self.assertEqual(prime_generator(-12),
                      "The number has to be greater than 1")
 def test_correct_input(self):
     self.assertEquals(prime_generator(13), [2, 3, 5, 7, 11, 13])
示例#7
0
 def test_number_one(self):
     self.assertEqual(testcases.prime_generator(1), [])
示例#8
0
 def test_negative_numbers(self):
     self.assertEqual(testcases.prime_generator(-5),
                      "Negative numbers not allowed.")
示例#9
0
 def test_prime_generator(self):
     self.assertEqual(testcases.prime_generator(10), [2, 3, 5, 7])
示例#10
0
 def test_prime_4(self):
     self.assertEqual(testcases.prime_generator(4), "Number is not prime")
示例#11
0
 def test_empty_parameter(self):
     self.assertRaises(testcases.prime_generator(),
                       " No  parameter provided")
示例#12
0
 def test_prime_50(self):
     self.assertEqual(
         testcases.prime_generator(50),
         [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47])
示例#13
0
 def test_prime_numbers_100(self):
     self.assertEqual(testcases.prime_generator(100), [
         2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61,
         67, 71, 73, 79, 83, 89, 97
     ])
示例#14
0
 def test_number_zero(self):
     self.assertEqual(testcases.prime_generator(0), [])
 def test_with_three(self):
     self.assertEqual(prime_generator(3), [2, 3])
 def test_return_list_for_valid_input(self):
     self.assertIsInstance(prime_generator(8), list)
 def test_with_large_num(self):
     my_list = [
         2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61,
         67
     ]
     self.assertEqual(prime_generator(70), my_list)
 def test_float_nums(self):
     with self.assertRaises(TypeError):
         prime_generator(9.23)
 def test_incorrect_data_types(self):
     with self.assertRaises(TypeError):
         prime_generator("test")
示例#20
0
 def test_int(self):
     self.assertEqual(testcases.prime_generator("str"),
                      "Only integers allowed")