-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
This reverts commit 791643f.
- Loading branch information
1 parent
6747f91
commit cb50bbf
Showing
2 changed files
with
88 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from readthedocs.doc_builder.backends.mkdocs import ProxyPythonName, yaml_load_safely | ||
|
||
content = """ | ||
int: 3 | ||
float: !!float 3 | ||
function: !!python/name:python_function | ||
other_function: !!python/name:module.other.function | ||
unknown: !!python/module:python_module | ||
""" | ||
|
||
|
||
def test_yaml_load_safely(): | ||
expected = { | ||
"int": 3, | ||
"float": 3.0, | ||
"function": ProxyPythonName("python_function"), | ||
"other_function": ProxyPythonName("module.other.function"), | ||
"unknown": None, | ||
} | ||
data = yaml_load_safely(content) | ||
|
||
assert data == expected | ||
assert type(data["int"]) is int | ||
assert type(data["float"]) is float | ||
assert type(data["function"]) is ProxyPythonName | ||
assert type(data["other_function"]) is ProxyPythonName | ||
assert data["function"].value == "python_function" | ||
assert data["other_function"].value == "module.other.function" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters