-
-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix URL encoded filenames #104
Changes from all commits
65967c7
40d7ebc
03bcdbd
fd757d2
9fb05df
315bdf1
dada752
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,6 +45,14 @@ def entries(): | |
] | ||
|
||
|
||
@pytest.fixture | ||
def entries_url_format(): | ||
return [ | ||
ParserEntry(name="foo", type="Method", path="foo%20bar.html#foo"), | ||
ParserEntry(name="qux", type="Class", path="foo%20bar.html"), | ||
] | ||
|
||
|
||
class TestPatchTOCAnchors: | ||
@pytest.mark.parametrize("progressbar", [True, False]) | ||
def test_with_empty_db(self, progressbar): | ||
|
@@ -71,6 +79,23 @@ def test_single_entry(self, monkeypatch, tmpdir, entries): | |
TOCEntry(name="foo", type="Method", anchor="foo") | ||
] == parser._patched_entries | ||
|
||
def test_single_entry_url_format( | ||
self, monkeypatch, tmpdir, entries_url_format | ||
): | ||
mofeing marked this conversation as resolved.
Show resolved
Hide resolved
|
||
""" | ||
URL-encoded filenames are decoded before being added. | ||
""" | ||
foo = tmpdir.mkdir("foo") | ||
foo.join("foo bar.html").write("docs!") | ||
parser = FakeParser(doc_path=str(foo)) | ||
toc = patch_anchors(parser, show_progressbar=False) | ||
for e in entries_url_format: | ||
toc.send(e) | ||
toc.close() | ||
assert [ | ||
TOCEntry(name="foo", type="Method", anchor="foo") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. wait, doesn't this mean that you've lost a TOCEntry somewhere? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm lost on writing a test. I though I could just add a new entry to the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No worries, I’ll have a look after Xmas. Happy holidays and thanks for your work so far! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, and happy holidays to you too! |
||
] == parser._patched_entries | ||
|
||
def test_complains(self, entries, tmpdir): | ||
""" | ||
If patching fails, a debug message is logged. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think there's a point to making this a fixture? I think it can be safely inlined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can just add a new entry in the
entries
fixture but I wanted to have a separate test just for checking URL-encoded filenames. I see know it can be done without a new fixture. Give me a sec.