test_form.py: fix test_choose_submit_twice #228
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When a BeautifulSoup object is constructed from an html string,
it will standardize the html. In this case, since the input html
was just a raw
<form>
, it added<html>
and<body>
tags around it.Since the
Form
ctor now demands that it is passed a<form>
element,we need to extract
<form>
from the object BeautifulSoup constructsto pass to the
Form
ctor.Side question: The sanity check on
Form
being passed a<form>
is in principle a good one, since I have seen plenty of errors that resulted from passing something that wasn't (or didn't even contain) a form to theForm
ctor. But is it too restrictive? Should we expect that passing a<html><body><form>...</form></body></html>
toForm
should work? And if so, could we allow such a thing without also letting people make more egregious mistakes?