import unittest


class TestDemo(unittest.TestCase):
    # unittest要求测试的类里需要继承上面的unittest.TestCase方法

    @classmethod
    def setUpClass(cls) -> None:
        print("setup class")

    def setUp(self) -> None:
        print("\nsetup\n")

    @classmethod
    def tearDownClass(cls) -> None:
        print("teardown class")

    def tearDown(self) -> None:
        print("\nteardown\n")

    def test_sum(self):
        print("test_sum")
        x = 1 + 2
        print(x)
        self.assertEqual(3, x, f'x={x} expection=3')

    def test_demo(self):
        print("test_demo")
        self.assertTrue(True)


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

d418181a6e9a800e9f26029f0ae8da5932dd657f
<mask token>


class TestDemo(unittest.TestCase):
    <mask token>
    <mask token>

    @classmethod
    def tearDownClass(cls) ->None:
        print('teardown class')

    def tearDown(self) ->None:
        print('\nteardown\n')
    <mask token>

    def test_demo(self):
        print('test_demo')
        self.assertTrue(True)


<mask token>

<mask token>


class TestDemo(unittest.TestCase):

    @classmethod
    def setUpClass(cls) ->None:
        print('setup class')
    <mask token>

    @classmethod
    def tearDownClass(cls) ->None:
        print('teardown class')

    def tearDown(self) ->None:
        print('\nteardown\n')

    def test_sum(self):
        print('test_sum')
        x = 1 + 2
        print(x)
        self.assertEqual(3, x, f'x={x} expection=3')

    def test_demo(self):
        print('test_demo')
        self.assertTrue(True)


<mask token>

<mask token>


class TestDemo(unittest.TestCase):

    @classmethod
    def setUpClass(cls) ->None:
        print('setup class')

    def setUp(self) ->None:
        print('\nsetup\n')

    @classmethod
    def tearDownClass(cls) ->None:
        print('teardown class')

    def tearDown(self) ->None:
        print('\nteardown\n')

    def test_sum(self):
        print('test_sum')
        x = 1 + 2
        print(x)
        self.assertEqual(3, x, f'x={x} expection=3')

    def test_demo(self):
        print('test_demo')
        self.assertTrue(True)


<mask token>

import unittest


class TestDemo(unittest.TestCase):

    @classmethod
    def setUpClass(cls) ->None:
        print('setup class')

    def setUp(self) ->None:
        print('\nsetup\n')

    @classmethod
    def tearDownClass(cls) ->None:
        print('teardown class')

    def tearDown(self) ->None:
        print('\nteardown\n')

    def test_sum(self):
        print('test_sum')
        x = 1 + 2
        print(x)
        self.assertEqual(3, x, f'x={x} expection=3')

    def test_demo(self):
        print('test_demo')
        self.assertTrue(True)


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

import unittest


class TestDemo(unittest.TestCase):
    # unittest要求测试的类里需要继承上面的unittest.TestCase方法

    @classmethod
    def setUpClass(cls) -> None:
        print("setup class")

    def setUp(self) -> None:
        print("\nsetup\n")

    @classmethod
    def tearDownClass(cls) -> None:
        print("teardown class")

    def tearDown(self) -> None:
        print("\nteardown\n")

    def test_sum(self):
        print("test_sum")
        x = 1 + 2
        print(x)
        self.assertEqual(3, x, f'x={x} expection=3')

    def test_demo(self):
        print("test_demo")
        self.assertTrue(True)


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