(self, element_name)
| 597 | .format(element_name, self._spec.name)) |
| 598 | |
| 599 | def get_children(self, element_name): |
| 600 | child_spec = self._check_valid_child(element_name) |
| 601 | if child_spec.repeated: |
| 602 | return _ElementListView(spec=child_spec, parent=self) |
| 603 | else: |
| 604 | for child in self._children: |
| 605 | if child.tag == element_name: |
| 606 | return child |
| 607 | if child_spec.on_demand: |
| 608 | return None |
| 609 | else: |
| 610 | raise RuntimeError( |
| 611 | 'Cannot find the non-repeated child <{}> of <{}>. ' |
| 612 | 'This should never happen, as we pre-create these in __init__. ' |
| 613 | 'Please file an bug report. Thank you.' |
| 614 | .format(element_name, self._spec.name)) |
| 615 | |
| 616 | def add(self, element_name, **kwargs): |
| 617 | """Add a new child element to this element. |
no test coverage detected