INNER CODE UNIT · Python
test_returns_empty_when_no_comment
connectbot/connectbot · translations/test_translate.py:69
def test_returns_empty_when_no_comment(self):
root = resources_elem('<string name="title">Hello</string>')
elem = root.find("string")
assert preceding_comment(elem) == ""
def test_stops_at_intervening_element(self):
root = resources_elem(
'<!-- Old comment -->\n'
'<string name="other">Other</string>\n'
'<string name="title">Hello</string>'
)
elem = root.findall("string")[1]
assert preceding_comment(elem) == ""
def test_strips_whitespace(self):
root = resources_elem('<!-- padded comment -->\n<string name="x">X</string>')
elem = root.find("string")
assert preceding_comment(elem) == "padded comment"