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

Function test_existing_path_FileLinks_alt_formatter

tests/test_display.py:120–136  ·  view source on GitHub ↗

FileLinks: Calling _repr_html_ functions as expected w/ an alt formatter

()

Source from the content-addressed store, hash-verified

118
119
120def test_existing_path_FileLinks_alt_formatter():
121 """FileLinks: Calling _repr_html_ functions as expected w/ an alt formatter"""
122 td = mkdtemp()
123 tf1 = NamedTemporaryFile(dir=td)
124 tf2 = NamedTemporaryFile(dir=td)
125
126 def fake_formatter(dirname, fnames, included_suffixes):
127 return ["hello", "world"]
128
129 fl = display.FileLinks(td, notebook_display_formatter=fake_formatter)
130 actual = fl._repr_html_()
131 actual = actual.split("\n")
132 actual.sort()
133 expected = ["hello", "world"]
134 expected.sort()
135 # We compare the sorted list of links here as that's more reliable
136 assert actual == expected
137
138
139def test_existing_path_FileLinks_repr():

Callers

nothing calls this directly

Calls 2

sortMethod · 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…