def test_boolean_attribute(self): # ability to serialize boolean attribute by setting value to None form = html.Element('form') form.set('novalidate', None) self.assertEqual(html.tostring(form), _bytes('<form novalidate></form>')) form.set('custom') self.assertEqual(html.tostring(form), _bytes('<form novalidate custom></form>'))
def test_boolean_attribute_round_trip(self): # ability to pass boolean attributes unmodified fragment = '<tag attribute></tag>' self.assertEqual(html.tostring(html.fragment_fromstring(fragment)), _bytes(fragment))