INNER CODE UNIT · Python
TestBuildTargetIndex
connectbot/connectbot · translations/test_translate.py:247
class TestBuildTargetIndex:
def test_indexes_string_elements(self):
root = resources_elem(
'<string name="foo">Foo</string>\n'
'<string name="bar">Bar</string>'
)
idx = build_target_index(root)
assert set(idx.keys()) == {"foo", "bar"}
def test_ignores_comments(self):
root = resources_elem('<!-- comment -->\n<string name="foo">Foo</string>')
idx = build_target_index(root)
assert list(idx.keys()) == ["foo"]
def test_ignores_non_translatable_tags(self):
root = parse(resources_xml('<color name="red">#FF0000</color>'))
idx = build_target_index(root)
assert idx == {}