def test_content_tree_with_child_instruction(self): template_xml = pkg_resources.resource_filename( 'py3o.template', 'tests/templates/py3o_example_invalid_template.odt' ) t = Template(template_xml, get_secure_filename()) usr_insts = t.get_user_instructions() assert usr_insts == ['for="item in items"', '/for', 'for="item in items', '2', '"', '/for']
def test_get_user_instructions(self): source_odt_filename = pkg_resources.resource_filename( 'py3o.template', 'tests/templates/py3o_example_template.odt') outfilename = get_secure_filename() template = Template(source_odt_filename, outfilename) user_instructions = template.get_user_instructions() expected_vars = [ 'for="line in items"', '/for', 'for="item in items"', 'if="item.InvoiceRef==\'#1234\'"', '/if', '/for', ] assert set(user_instructions) == set(expected_vars)
def test_get_user_instructions(self): source_odt_filename = pkg_resources.resource_filename( "py3o.template", "tests/templates/py3o_example_template.odt" ) outfilename = get_secure_filename() template = Template(source_odt_filename, outfilename) user_instructions = template.get_user_instructions() expected_vars = [ 'for="line in items"', "/for", 'for="item in items"', "if=\"item.InvoiceRef=='#1234'\"", "/if", "/for", ] assert set(user_instructions) == set(expected_vars)
def test_get_user_instructions(self): source_odt_filename = pkg_resources.resource_filename( 'py3o.template', 'tests/templates/py3o_example_template.odt' ) outfilename = get_secure_filename() template = Template(source_odt_filename, outfilename) user_instructions = template.get_user_instructions() expected_vars = [ 'for="line in items"', '/for', 'for="item in items"', 'if="item.InvoiceRef==\'#1234\'"', '/if', '/for', ] assert set(user_instructions) == set(expected_vars)