INNER CODE UNIT · Python

TestElementText

connectbot/connectbot · translations/test_translate.py:120

class TestElementText:
    def test_get_string(self):
        elem = parse('<string name="x">Hello world</string>')
        assert get_element_text(elem) == "Hello world"

    def test_get_string_array(self):
        elem = parse(
            "<string-array name='x'>"
            "<item>One</item><item>Two</item>"
            "</string-array>"
        )
        assert get_element_text(elem) == "One\nTwo"

    def test_set_string(self):
        elem = parse('<string name="x">Hello</string>')
        source = parse('<string name="x">Hello</string>')
        set_element_text(elem, "Hola", source)
        assert elem.text == "Hola"

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…