You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I'd like to use gazpacho for testing the HTML output of my Django application. A natural way to do this would be to search for a given HTML chunk. Therefore I'd like to be able to use the in operator on a Soup to check for that HTML chunk. This probably has utility outside of tests.
Describe the solution you'd like
I imagine this working something like:
response=self.client.get('/') # django's test clientassertresponse.status_code==HTTPStatus.OKbody=response.content.decode()
assert'<h1><a href="/">Home page</a></h1>'inSoup(body)
Describe alternatives you've considered
It's possible to reproduce this with find() and making assertions on the contents of the found node, but much more complicated since it requires assertions for each node in the tree.
Additional information
Django already supports a similar assertion called assertInHTML. However this relies on normalizing the HTML text and making text assertions, so it's clunky around matching the actual elements.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
I'd like to use
gazpacho
for testing the HTML output of my Django application. A natural way to do this would be to search for a given HTML chunk. Therefore I'd like to be able to use thein
operator on aSoup
to check for that HTML chunk. This probably has utility outside of tests.Describe the solution you'd like
I imagine this working something like:
Describe alternatives you've considered
It's possible to reproduce this with
find()
and making assertions on the contents of the found node, but much more complicated since it requires assertions for each node in the tree.Additional information
Django already supports a similar assertion called
assertInHTML
. However this relies on normalizing the HTML text and making text assertions, so it's clunky around matching the actual elements.The text was updated successfully, but these errors were encountered: