/
githubmirror
/
nbs
Обзор
Документация
Войти
/
githubmirror
/
nbs
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
contrib/python/traitlets/py3/tests/utils/test_importstring.py
27 строк
888 B
Anton Myagkov
Update ydb version to 24.4 (#4579)
07 фев 2026, 11:59
Не верифицирован
07 фев 2026, 11:59
2c21cae
Код
Авторство
О чём код?
# 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.""" from __future__ import annotations import os from unittest import TestCase from traitlets.utils.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()) # type:ignore[arg-type]