MCPcopy Index your code
hub / github.com/ipython/ipython / test_existing_path_FileLinks

Function test_existing_path_FileLinks

tests/test_display.py:97–117  ·  view source on GitHub ↗

FileLinks: Calling _repr_html_ functions as expected on existing dir

()

Source from the content-addressed store, hash-verified

95
96
97def test_existing_path_FileLinks():
98 """FileLinks: Calling _repr_html_ functions as expected on existing dir"""
99 td = mkdtemp()
100 tf1 = NamedTemporaryFile(dir=td)
101 tf2 = NamedTemporaryFile(dir=td)
102 fl = display.FileLinks(td)
103 actual = fl._repr_html_()
104 actual = actual.split("\n")
105 actual.sort()
106 # the links should always have forward slashes, even on windows, so replace
107 # backslashes with forward slashes here
108 expected = [
109 "%s/<br>" % td,
110 "&nbsp;&nbsp;<a href='%s' target='_blank'>%s</a><br>"
111 % (tf2.name.replace("\\", "/"), split(tf2.name)[1]),
112 "&nbsp;&nbsp;<a href='%s' target='_blank'>%s</a><br>"
113 % (tf1.name.replace("\\", "/"), split(tf1.name)[1]),
114 ]
115 expected.sort()
116 # We compare the sorted list of links here as that's more reliable
117 assert actual == expected
118
119
120def test_existing_path_FileLinks_alt_formatter():

Callers

nothing calls this directly

Calls 3

sortMethod · 0.80
replaceMethod · 0.80
_repr_html_Method · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…