diff options
author | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2023-02-09 22:46:44 +0100 |
---|---|---|
committer | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2023-02-09 23:53:46 +0100 |
commit | 1c555aae67471d454f13b94f7083feb48efd6bb4 (patch) | |
tree | 2e4efc227a4e2771ec7c6905054d0f25dd56ea2a | |
parent | 4257af648981f855f0922e57f90aeae1dee8c6cf (diff) | |
download | astroid-git-1c555aae67471d454f13b94f7083feb48efd6bb4.tar.gz |
[brain tests] Burst dateutil from the main file
-rw-r--r-- | tests/brain/test_brain.py | 20 | ||||
-rw-r--r-- | tests/brain/test_dateutil.py | 29 |
2 files changed, 29 insertions, 20 deletions
diff --git a/tests/brain/test_brain.py b/tests/brain/test_brain.py index 0f9c7d82..fd5c8173 100644 --- a/tests/brain/test_brain.py +++ b/tests/brain/test_brain.py @@ -24,13 +24,6 @@ from astroid.nodes.node_classes import Const from astroid.nodes.scoped_nodes import ClassDef try: - import dateutil # pylint: disable=unused-import - - HAS_DATEUTIL = True -except ImportError: - HAS_DATEUTIL = False - -try: import attr as attr_module # pylint: disable=unused-import HAS_ATTR = True @@ -648,19 +641,6 @@ class EnumBrainTest(unittest.TestCase): node.inferred() -@unittest.skipUnless(HAS_DATEUTIL, "This test requires the dateutil library.") -class DateutilBrainTest(unittest.TestCase): - def test_parser(self): - module = builder.parse( - """ - from dateutil.parser import parse - d = parse('2000-01-01') - """ - ) - d_type = next(module["d"].infer()) - self.assertEqual(d_type.qname(), "datetime.datetime") - - class PytestBrainTest(unittest.TestCase): def test_pytest(self) -> None: ast_node = builder.extract_node( diff --git a/tests/brain/test_dateutil.py b/tests/brain/test_dateutil.py new file mode 100644 index 00000000..d542e8b7 --- /dev/null +++ b/tests/brain/test_dateutil.py @@ -0,0 +1,29 @@ +# Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html +# For details: https://github.com/PyCQA/astroid/blob/main/LICENSE +# Copyright (c) https://github.com/PyCQA/astroid/blob/main/CONTRIBUTORS.txt + +from __future__ import annotations + +import unittest + +from astroid import builder + +try: + import dateutil # pylint: disable=unused-import + + HAS_DATEUTIL = True +except ImportError: + HAS_DATEUTIL = False + + +@unittest.skipUnless(HAS_DATEUTIL, "This test requires the dateutil library.") +class DateutilBrainTest(unittest.TestCase): + def test_parser(self): + module = builder.parse( + """ + from dateutil.parser import parse + d = parse('2000-01-01') + """ + ) + d_type = next(module["d"].infer()) + self.assertEqual(d_type.qname(), "datetime.datetime") |