Uploaded Test files
This commit is contained in:
parent
f584ad9d97
commit
2e81cb7d99
16627 changed files with 2065359 additions and 102444 deletions
0
venv/Lib/site-packages/traitlets/utils/tests/__init__.py
Normal file
0
venv/Lib/site-packages/traitlets/utils/tests/__init__.py
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
14
venv/Lib/site-packages/traitlets/utils/tests/test_bunch.py
Normal file
14
venv/Lib/site-packages/traitlets/utils/tests/test_bunch.py
Normal file
|
@ -0,0 +1,14 @@
|
|||
from ..bunch import Bunch
|
||||
|
||||
def test_bunch():
|
||||
b = Bunch(x=5, y=10)
|
||||
assert 'y' in b
|
||||
assert 'x' in b
|
||||
assert b.x == 5
|
||||
b['a'] = 'hi'
|
||||
assert b.a == 'hi'
|
||||
|
||||
def test_bunch_dir():
|
||||
b = Bunch(x=5, y=10)
|
||||
assert 'x' in dir(b)
|
||||
assert 'keys' in dir(b)
|
|
@ -0,0 +1,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())
|
Loading…
Add table
Add a link
Reference in a new issue