diff options
author | Daniel Holth <dholth@fastmail.fm> | 2016-07-29 07:27:22 -0400 |
---|---|---|
committer | Daniel Holth <dholth@fastmail.fm> | 2016-07-29 07:27:22 -0400 |
commit | 02c419cbf65de900da208b037363d1d5fdbb31f0 (patch) | |
tree | 1c5767ea0b838d9005dc5a0f77ec7e57fea36ad5 /src | |
parent | fce178735f9e63ab636eca5544be3e1a7e0582d7 (diff) | |
download | python-lxml-02c419cbf65de900da208b037363d1d5fdbb31f0.tar.gz |
docs, additional tests for boolean attributes
Diffstat (limited to 'src')
-rw-r--r-- | src/lxml/tests/test_htmlparser.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/lxml/tests/test_htmlparser.py b/src/lxml/tests/test_htmlparser.py index b3a36f78..6a436a6f 100644 --- a/src/lxml/tests/test_htmlparser.py +++ b/src/lxml/tests/test_htmlparser.py @@ -599,6 +599,18 @@ class HtmlParserTestCase(HelperTestCase): self.assertEqual(html.tostring(form), _bytes('<form novalidate></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)) + + def test_boolean_attribute_xml_adds_empty_string(self): + # html serialized as xml converts boolean attributes to empty strings + fragment = '<tag attribute></tag>' + self.assertEqual(self.etree.tostring(html.fragment_fromstring(fragment)), + _bytes('<tag attribute=""/>')) + def test_suite(): suite = unittest.TestSuite() |