Пример #1
0
 def test_when_n_is_two(self):
     self.assertEqual(nth_prime(2),
                      3,
                      msg="Second prime number should be 3")
Пример #2
0
 def test_when_n_is_one(self):
     self.assertEqual(nth_prime(1), 2, msg="First prime number should be 2")
Пример #3
0
 def test_when_n_is_zero(self):
     self.assertFalse(nth_prime(0), msg="Zero should not be allowed")
Пример #4
0
 def test_when_no_argument_passed(self):
     with self.assertRaises(TypeError):
         nth_prime()
Пример #5
0
 def test_when_n_is_negative(self):
     self.assertFalse(nth_prime(-1),
                      msg="Negative numbers should not be allowed")