FileLinks: Calling _repr_html_ functions as expected on existing dir
()
| 93 | nt.assert_true(fls._repr_html_().startswith('Path (<tt>example</tt>)')) |
| 94 | |
| 95 | def test_existing_path_FileLinks(): |
| 96 | """FileLinks: Calling _repr_html_ functions as expected on existing dir |
| 97 | """ |
| 98 | td = mkdtemp() |
| 99 | tf1 = NamedTemporaryFile(dir=td) |
| 100 | tf2 = NamedTemporaryFile(dir=td) |
| 101 | fl = display.FileLinks(td) |
| 102 | actual = fl._repr_html_() |
| 103 | actual = actual.split('\n') |
| 104 | actual.sort() |
| 105 | # the links should always have forward slashes, even on windows, so replace |
| 106 | # backslashes with forward slashes here |
| 107 | expected = ["%s/<br>" % td, |
| 108 | " <a href='%s' target='_blank'>%s</a><br>" %\ |
| 109 | (tf2.name.replace("\\","/"),split(tf2.name)[1]), |
| 110 | " <a href='%s' target='_blank'>%s</a><br>" %\ |
| 111 | (tf1.name.replace("\\","/"),split(tf1.name)[1])] |
| 112 | expected.sort() |
| 113 | # We compare the sorted list of links here as that's more reliable |
| 114 | nt.assert_equal(actual,expected) |
| 115 | |
| 116 | def test_existing_path_FileLinks_alt_formatter(): |
| 117 | """FileLinks: Calling _repr_html_ functions as expected w/ an alt formatter |
nothing calls this directly
no test coverage detected