MCPcopy
hub / github.com/django/django / append

Method append

django/test/html.py:76–90  ·  view source on GitHub ↗
(self, element)

Source from the content-addressed store, hash-verified

74 self.children = []
75
76 def append(self, element):
77 if isinstance(element, str):
78 element = normalize_whitespace(element)
79 if self.children and isinstance(self.children[-1], str):
80 self.children[-1] += element
81 self.children[-1] = normalize_whitespace(self.children[-1])
82 return
83 elif self.children:
84 # removing last children if it is only whitespace
85 # this can result in incorrect dom representations since
86 # whitespace between inline tags like <span> is significant
87 if isinstance(self.children[-1], str) and self.children[-1].isspace():
88 self.children.pop()
89 if element:
90 self.children.append(element)
91
92 def finalize(self):
93 def rstrip_last_element(children):

Callers 15

paragraphsFunction · 0.45
add_itemMethod · 0.45
repercent_broken_unicodeFunction · 0.45
wrapFunction · 0.45
handle_starttagMethod · 0.45
handle_endtagMethod · 0.45
handle_dataMethod · 0.45
processMethod · 0.45
wrapperFunction · 0.45
iter_modules_and_filesFunction · 0.45
_watch_globMethod · 0.45
formatMethod · 0.45

Calls 2

normalize_whitespaceFunction · 0.85
popMethod · 0.45

Tested by 15

on_template_renderMethod · 0.36
test_db_signatureMethod · 0.36
patch_urlopenFunction · 0.36
get_test_modulesFunction · 0.36
setup_run_testsFunction · 0.36
get_subprocess_argsFunction · 0.36
runnerMethod · 0.36
runnerMethod · 0.36
unraisablehookMethod · 0.36
addTestMethod · 0.36
new_format_sqlMethod · 0.36