import unittest


def quadratic_sum(n: int) -> int:
    """calculate the quadratic num from 1 ~ n"""
    sum = 0
    for n in range(1, n + 1):
        sum += n ** 2
    return sum


class MyTestCase(unittest.TestCase):
    def test_something(self):
        self.assertEqual(quadratic_sum(1), 1)
        self.assertEqual(quadratic_sum(2), 5)
        self.assertEqual(quadratic_sum(3), 14)


if __name__ == '__main__':
    unittest.main()

import unittest


def quadratic_sum(n: int) -> int:
    """calculate the quadratic num from 1 ~ n"""
    sum = 0
    for n in range(1, n + 1):
        sum += n ** 2
    return sum


class MyTestCase(unittest.TestCase):
    def test_something(self):
        self.assertEqual(quadratic_sum(1), 1)
        self.assertEqual(quadratic_sum(2), 5)
        self.assertEqual(quadratic_sum(3), 14)


if __name__ == '__main__':
    unittest.main()

calculate the quadratic num from 1 ~ n