INNER CODE UNIT · Python

TestEnsureToolsNamespace

connectbot/connectbot · translations/test_translate.py:271

class TestEnsureToolsNamespace:
    def test_new_resources_tree_has_tools_namespace(self):
        tree = new_resources_tree()
        root = tree.getroot()
        assert TOOLS_NS in root.nsmap.values()

    def test_adds_namespace_to_root_without_it(self):
        root = parse("<resources><string name='x'>X</string></resources>")
        new_root = ensure_tools_namespace(root)
        assert TOOLS_NS in new_root.nsmap.values()
        assert new_root.find("string[@name='x']") is not None

    def test_noop_when_namespace_already_present(self):
        root = parse(f'<resources xmlns:tools="{TOOLS_NS}"></resources>')
        result = ensure_tools_namespace(root)
        assert result is root

    def test_namespace_present_after_translation(self, tmp_path):

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…