/usr/lib/python3/dist-packages/traitlets/utils/tests/test_importstring.py is in python3-traitlets 4.3.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | # encoding: utf-8
# 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(u'os'))
self.assertIs(os.path, import_item(u'os.path'))
self.assertIs(os.path.join, import_item(u'os.path.join'))
def test_bad_input(self):
class NotAString(object):
pass
msg = (
"import_item accepts strings, "
"not '%s'." % NotAString
)
with self.assertRaisesRegexp(TypeError, msg):
import_item(NotAString())
|