diff options
| author | Ionel Cristian Mărieș <contact@ionelmc.ro> | 2014-06-16 20:09:32 +0300 |
|---|---|---|
| committer | Ionel Cristian Mărieș <contact@ionelmc.ro> | 2014-06-16 20:09:32 +0300 |
| commit | 14ce04ba6b33940ce84c00c3e0544e8b541a4291 (patch) | |
| tree | ac0efea7c2e9a74ec10173dd24bbfbdf86299235 /src/lxml/tests | |
| parent | 35316b052af48921657813bb68563fe4a301d1b8 (diff) | |
| download | python-lxml-14ce04ba6b33940ce84c00c3e0544e8b541a4291.tar.gz | |
Add CDATA support in ElementBuilder.
Diffstat (limited to 'src/lxml/tests')
| -rw-r--r-- | src/lxml/tests/test_builder.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/lxml/tests/test_builder.py b/src/lxml/tests/test_builder.py index e09edb60..4a7ce97a 100644 --- a/src/lxml/tests/test_builder.py +++ b/src/lxml/tests/test_builder.py @@ -15,6 +15,7 @@ if this_dir not in sys.path: from common_imports import HelperTestCase, BytesIO, _bytes + class BuilderTestCase(HelperTestCase): etree = etree @@ -28,6 +29,13 @@ class BuilderTestCase(HelperTestCase): pass self.assertRaises(TypeError, E.b, UnknownType()) + def test_cdata(self): + wrapped = E.b(etree.CDATA('Hello')) + self.assertEqual(_bytes('<b><![CDATA[Hello]]></b>'), etree.tostring(wrapped)) + + def test_cdata_solo(self): + self.assertRaises(ValueError, E.b, 'Hello', etree.CDATA('World')) + def test_suite(): suite = unittest.TestSuite() |
