summaryrefslogtreecommitdiff
path: root/tests/unittest_brain_unittest.py
blob: 644614d8da12a9e0e0246686db9c52cee64ce7cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import unittest

from astroid import builder
from astroid.test_utils import require_version


class UnittestTest(unittest.TestCase):
    """
    A class that tests the brain_unittest module
    """

    @require_version(minver="3.8.0")
    def test_isolatedasynciotestcase(self):
        """
        Tests that the IsolatedAsyncioTestCase class is statically imported
        thanks to the brain_unittest module.
        """
        node = builder.extract_node(
            """
        from unittest import IsolatedAsyncioTestCase

        class TestClass(IsolatedAsyncioTestCase):
            pass
        """
        )
        assert [n.qname() for n in node.ancestors()] == [
            "unittest.async_case.IsolatedAsyncioTestCase",
            "unittest.case.TestCase",
            "builtins.object",
        ]