def test_power(self): self.assertIsNotNone(main.power) self.assertEqual(main.power(3, 4), 3**4) self.assertEqual(main.power(-2, 3), -2**3) self.assertEqual(main.power(62, 0), 1) for _ in range(10): x = random.randrange(-10, 10) y = random.randrange(0, 10) self.assertEqual(main.power(x, y), x**y)
def test_answer(self): assert power(1, 2) == 1 assert power(3, 2) == 9 assert power(2, 3) == 8
def test_power(self): self.assertEqual(main.power(3, 3), 27, 'power fail')
def test_power3(self): self.assertEqual(main.power("ynfj49 d"), False, "The power test failed on 'ynfj49 d'")
def test_power2(self): self.assertEqual(main.power("n"), False, "The power test failed on 'n'")
def test_power1(self): self.assertEqual(main.power("y"), True, "The power test failed on 'y'")