def test__add_unit_to_tree(): from translate.storage import xliff xliff_file = xliff.xlifffile # xliff_file = factory.classes[u'xlf']() # Add the first unit unit_1 = xliff_file.UnitClass(u"Hello") xpath_1 = u"document-content[1]/body[1]/text[1]/p[1]" constructed_tree_1 = unit_tree.XPathTree() unit_tree._add_unit_to_tree(constructed_tree_1, unit_tree._split_xpath(xpath_1), unit_1) test_tree_1 = make_tree_1(unit_1) assert test_tree_1 == constructed_tree_1 # Add another unit unit_2 = xliff_file.UnitClass(u"World") xpath_2 = u"document-content[1]/body[2]/text[3]/p[4]" constructed_tree_2 = make_tree_1(unit_1) unit_tree._add_unit_to_tree(constructed_tree_2, unit_tree._split_xpath(xpath_2), unit_2) test_tree_2 = make_tree_2(unit_1, unit_2) assert test_tree_2 == constructed_tree_2
def test__add_unit_to_tree(): from translate.storage import xliff xliff_file = xliff.xlifffile # xliff_file = factory.classes['xlf']() # Add the first unit unit_1 = xliff_file.UnitClass("Hello") xpath_1 = "document-content[1]/body[1]/text[1]/p[1]" constructed_tree_1 = unit_tree.XPathTree() unit_tree._add_unit_to_tree(constructed_tree_1, unit_tree._split_xpath(xpath_1), unit_1) test_tree_1 = make_tree_1(unit_1) assert test_tree_1 == constructed_tree_1 # Add another unit unit_2 = xliff_file.UnitClass("World") xpath_2 = "document-content[1]/body[2]/text[3]/p[4]" constructed_tree_2 = make_tree_1(unit_1) unit_tree._add_unit_to_tree(constructed_tree_2, unit_tree._split_xpath(xpath_2), unit_2) test_tree_2 = make_tree_2(unit_1, unit_2) assert test_tree_2 == constructed_tree_2
def test__add_unit_to_tree(): xliff_file = factory.classes[u'xlf']() # Add the first unit unit_1 = xliff_file.UnitClass(u'Hello') xpath_1 = u'document-content[1]/body[1]/text[1]/p[1]' constructed_tree_1 = unit_tree.XPathTree() unit_tree._add_unit_to_tree(constructed_tree_1, unit_tree._split_xpath(xpath_1), unit_1) test_tree_1 = make_tree_1(unit_1) assert test_tree_1 == constructed_tree_1 # Add another unit unit_2 = xliff_file.UnitClass(u'World') xpath_2 = u'document-content[1]/body[2]/text[3]/p[4]' constructed_tree_2 = make_tree_1(unit_1) unit_tree._add_unit_to_tree(constructed_tree_2, unit_tree._split_xpath(xpath_2), unit_2) test_tree_2 = make_tree_2(unit_1, unit_2) assert test_tree_2 == constructed_tree_2