File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -244,5 +244,22 @@ def sanitize_intersphinx_mapping(mapping: dict) -> dict:
244244
245245 Returns:
246246 dict -- A dictionary with the same structure but with sanitized URLs.
247+
248+ Unit-Testing:
249+
250+ Testcase 1: Basic intersphinx mapping.
251+
252+ >>> mapping = {'python': ('https://docs.python.org/3', None)}
253+ >>> sanitize_intersphinx_mapping(mapping)
254+ {'python': ('https://docs.python.org/3', None)}
255+
256+ Testcase 2: Mapping with URL containing special characters.
257+
258+ >>> mapping = {'project': ('https://github.com/user/project with spaces', None)}
259+ >>> result = sanitize_intersphinx_mapping(mapping)
260+ >>> result['project'][0]
261+ 'https://github.com/user/project%20with%20spaces'
262+ >>>
263+
247264 """
248265 return {key : (sanitize_url (url ), extra_value ) for key , (url , extra_value ) in mapping .items ()}
You can’t perform that action at this time.
0 commit comments