def test__XMLTypeDocumentRoot_full(): inst = XMLTypes.ProcessingInstruction() document = XMLTypes.XMLTypeDocumentRoot(mixed={'x': 0}, xMLNSPrefixMap={'y': 1}, xSISchemaLocation={'z': 2}, cDATA=('my_data', ), comment=('my_comment', ), text=('my_text', ), processingInstruction=(inst, )) assert document.mixed['x'] == 0 assert document.xMLNSPrefixMap['y'] == 1 assert document.xSISchemaLocation['z'] == 2 assert 'my_data' in document.cDATA assert 'my_text' in document.text assert 'my_comment' in document.comment assert inst in document.processingInstruction document.cDATA = EOrderedSet(document, XMLTypes.XMLTypeDocumentRoot._cDATA) document.cDATA.append('v1') assert 'v1' in document.cDATA document.text = EOrderedSet(document, XMLTypes.XMLTypeDocumentRoot._text) document.text.append('v2') assert 'v2' in document.text document.comment = EOrderedSet(document, XMLTypes.XMLTypeDocumentRoot._comment) document.comment.append('v3') assert 'v3' in document.comment
def test__XMLTypeDocumentRoot_full(): inst = XMLTypes.ProcessingInstruction() document = XMLTypes.XMLTypeDocumentRoot(mixed={'x': 0}, xMLNSPrefixMap={'y': 1}, xSISchemaLocation={'z': 2}, processingInstruction=(inst, ), cDATA=('v1', ), text=('v2', ), comment=('v3', )) assert document.mixed['x'] == 0 assert document.xMLNSPrefixMap['y'] == 1 assert document.xSISchemaLocation['z'] == 2 assert inst in document.processingInstruction assert 'v1' in document.cDATA assert 'v2' in document.text assert 'v3' in document.comment
def test__ProcessingInstruction_bad_args(): with pytest.raises(AttributeError): XMLTypes.ProcessingInstruction(my_data='test')
def test__ProcessingInstruction_full(): instruction = XMLTypes.ProcessingInstruction(data='my_data', target='my_target') assert instruction.data == 'my_data' assert instruction.target == 'my_target'