##// END OF EJS Templates
Python 2.6 doesn't have assert_is
MinRK -
Show More
@@ -1,39 +1,39 b''
1 """Tests for IPython.utils.importstring."""
1 """Tests for IPython.utils.importstring."""
2
2
3 #-----------------------------------------------------------------------------
3 #-----------------------------------------------------------------------------
4 # Copyright (C) 2013 The IPython Development Team
4 # Copyright (C) 2013 The IPython Development Team
5 #
5 #
6 # Distributed under the terms of the BSD License. The full license is in
6 # Distributed under the terms of the BSD License. The full license is in
7 # the file COPYING, distributed as part of this software.
7 # the file COPYING, distributed as part of this software.
8 #-----------------------------------------------------------------------------
8 #-----------------------------------------------------------------------------
9
9
10 #-----------------------------------------------------------------------------
10 #-----------------------------------------------------------------------------
11 # Imports
11 # Imports
12 #-----------------------------------------------------------------------------
12 #-----------------------------------------------------------------------------
13
13
14 import nose.tools as nt
14 import nose.tools as nt
15
15
16 from IPython.utils.importstring import import_item
16 from IPython.utils.importstring import import_item
17
17
18 #-----------------------------------------------------------------------------
18 #-----------------------------------------------------------------------------
19 # Tests
19 # Tests
20 #-----------------------------------------------------------------------------
20 #-----------------------------------------------------------------------------
21
21
22 def test_import_plain():
22 def test_import_plain():
23 "Test simple imports"
23 "Test simple imports"
24 import os
24 import os
25 os2 = import_item('os')
25 os2 = import_item('os')
26 nt.assert_is(os, os2)
26 nt.assert_true(os is os2)
27
27
28
28
29 def test_import_nested():
29 def test_import_nested():
30 "Test nested imports from the stdlib"
30 "Test nested imports from the stdlib"
31 from os import path
31 from os import path
32 path2 = import_item('os.path')
32 path2 = import_item('os.path')
33 nt.assert_is(path, path2)
33 nt.assert_true(path is path2)
34
34
35
35
36 def test_import_raises():
36 def test_import_raises():
37 "Test that failing imports raise the right exception"
37 "Test that failing imports raise the right exception"
38 nt.assert_raises(ImportError, import_item, 'IPython.foobar')
38 nt.assert_raises(ImportError, import_item, 'IPython.foobar')
39
39
General Comments 0
You need to be logged in to leave comments. Login now