Show More
@@ -0,0 +1,64 b'' | |||||
|
1 | """Tests for IPython.lib.display. | |||
|
2 | ||||
|
3 | """ | |||
|
4 | #----------------------------------------------------------------------------- | |||
|
5 | # Copyright (c) 2012, the IPython Development Team. | |||
|
6 | # | |||
|
7 | # Distributed under the terms of the Modified BSD License. | |||
|
8 | # | |||
|
9 | # The full license is in the file COPYING.txt, distributed with this software. | |||
|
10 | #----------------------------------------------------------------------------- | |||
|
11 | ||||
|
12 | #----------------------------------------------------------------------------- | |||
|
13 | # Imports | |||
|
14 | #----------------------------------------------------------------------------- | |||
|
15 | from __future__ import print_function | |||
|
16 | ||||
|
17 | # Third-party imports | |||
|
18 | import nose.tools as nt | |||
|
19 | ||||
|
20 | # Our own imports | |||
|
21 | from IPython.lib import display | |||
|
22 | ||||
|
23 | #----------------------------------------------------------------------------- | |||
|
24 | # Classes and functions | |||
|
25 | #----------------------------------------------------------------------------- | |||
|
26 | ||||
|
27 | #-------------------------- | |||
|
28 | # FileLink tests | |||
|
29 | #-------------------------- | |||
|
30 | ||||
|
31 | def test_instantiation_FileLink(): | |||
|
32 | """Test classes can be instantiated""" | |||
|
33 | fl = display.FileLink('example.txt') | |||
|
34 | ||||
|
35 | def test_warning_on_non_existant_path_FileLink(): | |||
|
36 | """Calling _repr_html_ on non-existant files returns a warning""" | |||
|
37 | fl = display.FileLink('example.txt') | |||
|
38 | nt.assert_true(fl._repr_html_().startswith('Path (<tt>example.txt</tt>)')) | |||
|
39 | ||||
|
40 | #-------------------------- | |||
|
41 | # FileLinks tests | |||
|
42 | #-------------------------- | |||
|
43 | ||||
|
44 | def test_instantiation_FileLinks(): | |||
|
45 | """Test classes can be instantiated""" | |||
|
46 | fls = display.FileLinks(['example1.txt','example2.txt']) | |||
|
47 | ||||
|
48 | def test_warning_on_non_existant_path_FileLinks(): | |||
|
49 | """Calling _repr_html_ on non-existant files returns a warning""" | |||
|
50 | fls = display.FileLinks('example') | |||
|
51 | nt.assert_true(fls._repr_html_().startswith('Path (<tt>example</tt>)')) | |||
|
52 | ||||
|
53 | #-------------------------- | |||
|
54 | # DirectoryLink tests | |||
|
55 | #-------------------------- | |||
|
56 | ||||
|
57 | def test_instantiation_DirectoryLink(): | |||
|
58 | """Test classes can be instantiated""" | |||
|
59 | dl = display.DirectoryLink('example') | |||
|
60 | ||||
|
61 | def test_warning_on_non_existant_path_DirectoryLink(): | |||
|
62 | """Calling _repr_html_ on non-existant files returns a warning""" | |||
|
63 | dl = display.DirectoryLink('example') | |||
|
64 | nt.assert_true(dl._repr_html_().startswith('Path (<tt>example</tt>)')) |
General Comments 0
You need to be logged in to leave comments.
Login now