def testnth_prime(self): self.assertEquals(2, problem007.nth_prime(1)) self.assertEquals(3, problem007.nth_prime(2)) self.assertEquals(5, problem007.nth_prime(3)) self.assertEquals(7, problem007.nth_prime(4)) self.assertEquals(11, problem007.nth_prime(5)) self.assertEquals(13, problem007.nth_prime(6))
def test_nth_prime(self): self.assertEqual(problem007.nth_prime(1), 2) self.assertEqual(problem007.nth_prime(2), 3) self.assertEqual(problem007.nth_prime(6), 13) self.assertNotEqual(problem007.nth_prime(6), 14)
#!/usr/bin/env python import sys import problem007 print(problem007.nth_prime(int(sys.argv[1])))