def css(): """Assert.css""" html = Assert(""" <div id="maincontent"> <div class="container"> <p>Hello World</p> </div> </div> """) html.css('#maincontent .container p')[0].text == 'Hello World' with Assert.raises(AssertionError): html.css('#maincontent .container p')[0].text != 'Hello World'