def test_answer(self): self.assertEqual(49, len(digit_powers()))
def test_digit_powers(self): for num in digit_powers(): digits = number_as_digits(num) root = int(round(pow(num, 1.0 / len(digits)))) self.assertEqual(num, root ** len(digits))
def test_sample_input(self): res = set(digit_powers()) self.assertTrue(16807 in res) self.assertTrue(134217728 in res)