Debian Codegraph @

tests/brain/test_unittest.py

raw
1 # Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html
2 # For details: https://github.com/pylint-dev/astroid/blob/main/LICENSE
3 # Copyright (c) https://github.com/pylint-dev/astroid/blob/main/CONTRIBUTORS.txt
4
5 import unittest
6
7 from astroid import builder
8
9
10 class UnittestTest(unittest.TestCase):
11 """A class that tests the brain_unittest module."""
12
13 def test_isolatedasynciotestcase(self):
14 """
15 Tests that the IsolatedAsyncioTestCase class is statically imported
16 thanks to the brain_unittest module.
17 """
18 node = builder.extract_node("""
19 from unittest import IsolatedAsyncioTestCase
20
21 class TestClass(IsolatedAsyncioTestCase):
22 pass
23 """)
24 assert [n.qname() for n in node.ancestors()] == [
25 "unittest.async_case.IsolatedAsyncioTestCase",
26 "unittest.case.TestCase",
27 "builtins.object",
28 ]