def test_isHappy(self): """ given: 19 return: True """ num = 19 expected = True sol = Solution() result = sol.isHappy(num) self.assertIs(result, expected)
def test_happy_number(self): solution = Solution() self.assertEqual(solution.isHappy(1), True) self.assertEqual(solution.isHappy(11), False) self.assertEqual(solution.isHappy(12), False) self.assertEqual(solution.isHappy(19), True) self.assertEqual(solution.isHappy(100), True)
def test_2_false(sol: Solution, ): assert sol.is_happy(2) == False
def sol() -> Solution: return Solution()
def test_2121_true(sol: Solution, ): assert sol.is_happy(2121) == True
def test_111111_false(sol: Solution, ): assert sol.is_happy(111111) == False
def test_19_true(sol: Solution, ): assert sol.is_happy(19) == True
def test_476_false(sol: Solution, ): assert sol.is_happy(476) == False