| Server IP : 217.160.0.212 / Your IP : 216.73.216.141 Web Server : Apache System : Linux www 6.18.51-i1-ampere #1196 SMP Fri Sep 11 20:43:55 CEST 2026 aarch64 User : sws1073854427 ( 1073854427) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /lib/python3/dist-packages/traitlets/utils/tests/ |
Upload File : |
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
#
# Adapted from enthought.traits, Copyright (c) Enthought, Inc.,
# also under the terms of the Modified BSD License.
"""Tests for traitlets.utils.importstring."""
import os
from unittest import TestCase
from ..importstring import import_item
class TestImportItem(TestCase):
def test_import_unicode(self):
self.assertIs(os, import_item("os"))
self.assertIs(os.path, import_item("os.path"))
self.assertIs(os.path.join, import_item("os.path.join"))
def test_bad_input(self):
class NotAString:
pass
msg = "import_item accepts strings, not '%s'." % NotAString
with self.assertRaisesRegex(TypeError, msg):
import_item(NotAString())