##// END OF EJS Templates
added tests of repr()
Greg Caporaso -
Show More
@@ -47,6 +47,14 b' def test_existing_path_FileLink():'
47 expected = "<a href='files/%s' target='_blank'>%s</a><br>" % (tf.name,tf.name)
47 expected = "<a href='files/%s' target='_blank'>%s</a><br>" % (tf.name,tf.name)
48 nt.assert_equal(actual,expected)
48 nt.assert_equal(actual,expected)
49
49
50 def test_existing_path_FileLink_repr():
51 """ Calling repr() functions as expected on existing filepath """
52 tf = NamedTemporaryFile()
53 fl = display.FileLink(tf.name)
54 actual = repr(fl)
55 expected = tf.name
56 nt.assert_equal(actual,expected)
57
50 #--------------------------
58 #--------------------------
51 # FileLinks tests
59 # FileLinks tests
52 #--------------------------
60 #--------------------------
@@ -75,6 +83,20 b' def test_existing_path_FileLinks():'
75 # We compare the sorted list of links here as that's more reliable
83 # We compare the sorted list of links here as that's more reliable
76 nt.assert_equal(actual,expected)
84 nt.assert_equal(actual,expected)
77
85
86 def test_existing_path_FileLinks_repr():
87 """ Calling repr() functions as expected on existing directory """
88 td = mkdtemp()
89 tf1 = NamedTemporaryFile(dir=td)
90 tf2 = NamedTemporaryFile(dir=td)
91 fl = display.FileLinks(td)
92 actual = repr(fl)
93 actual = actual.split('\n')
94 actual.sort()
95 expected = [tf1.name,tf2.name]
96 expected.sort()
97 # We compare the sorted list of links here as that's more reliable
98 nt.assert_equal(actual,expected)
99
78 #--------------------------
100 #--------------------------
79 # DirectoryLink tests
101 # DirectoryLink tests
80 #--------------------------
102 #--------------------------
General Comments 0
You need to be logged in to leave comments. Login now