Debian Codegraph @

traits/testing/tests/test_optional_dependencies.py

raw
1 # (C) Copyright 2005-2023 Enthought, Inc., Austin, TX
2 # All rights reserved.
3 #
4 # This software is provided without warranty under the terms of the BSD
5 # license included in LICENSE.txt and may be redistributed only under
6 # the conditions described in the aforementioned license. The license
7 # is also available online at http://www.enthought.com/licenses/BSD.txt
8 #
9 # Thanks for using Enthought open source!
10
11 import unittest
12
13 from traits.testing.optional_dependencies import optional_import
14
15
16 class TestImportHandler(unittest.TestCase):
17 def test_import_succeeds(self):
18
19 module = optional_import("itertools")
20 self.assertEqual(module.__name__, "itertools")
21
22 def test_import_fails(self):
23
24 module = optional_import("unavailable_module")
25 self.assertIsNone(module)