1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
from unittest import TestCase
from xsdata.formats.dataclass.models.generics import AnyElement
from xsdata.models.xsd import Annotation, AnnotationBase, Documentation
class AnnotationBaseTest(TestCase):
def test_property_dispaly_help(self):
base = AnnotationBase()
self.assertIsNone(base.display_help)
base.annotations.append(Annotation(documentations=[Documentation()]))
self.assertIsNone(base.display_help)
base.annotations.append(
Annotation(
documentations=[
Documentation(
elements=[
" I am a ",
AnyElement(
qname="{http://www.w3.org/1999/xhtml}p",
text="test",
tail="\n",
children=[
AnyElement(
qname="{http://www.w3.org/1999/xhtml}span",
text="!",
)
],
),
]
)
]
)
)
self.assertEqual("I am a <p>test<span>!</span></p>", base.display_help)
|