Skip to main content

A simple set of BeautifulSoup4 unit test helpers

Project description



>>> import soup_helpers as sh
>>> content = '<head><title>My Title</title></head>'
>>> sh.assertPageTitleEquals(content, title='My Title')

Misc Methods

>>> assertLinkWithTextExists(content, url='', text='My Link')
>>> assertPageTitleEquals(content, title='My Title')
>>> assertTagWithTextExists(content, tag='p', text='some text')

Form Methods

>>> assertFormFieldExists(content, tag='input', field_name='my_field')
>>> assertFormFieldExists(content, tag='select', field_name='my_field')
>>> assertFormFieldExists(content, tag='textarea', field_name='my_field')
>>> assertInputValueEquals(content, field_name='my_field', value='my value')
>>> assertInputValueEquals(content, field_name='my_field', value=None)
>>> assertSelectHasOptions(content, field_name='my_field', options_tuple=('One', 'Two'))
>>> assertSelectHasSelectedOption(content, field_name='my_field', text='my selected text')
>>> assertTextAreaContainsText(content, field_name='my_field', text='some textarea text')

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for soup_helpers, version 0.0.8
Filename, size File type Python version Upload date Hashes
Filename, size (5.3 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page