def test_write_hyperlink_rels(datadir):
from .. relations import write_rels
wb = Workbook()
ws = wb.active
assert 0 == len(ws.relationships)
ws.cell('A1').value = "test"
ws.cell('A1').hyperlink = "http://test.com/"
assert 1 == len(ws.relationships)
ws.cell('A2').value = "test"
ws.cell('A2').hyperlink = "http://test2.com/"
assert 2 == len(ws.relationships)
el = write_rels(ws, 1, 1)
xml = tostring(el)
datadir.chdir()
with open('sheet1_hyperlink.xml.rels') as expected:
diff = compare_xml(xml, expected.read())
assert diff is None, diff
test_relations.py 文件源码
python
阅读 22
收藏 0
点赞 0
评论 0
评论列表
文章目录