예제 #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")