test_iter.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:org-chart-builder 作者: Hitachi-Data-Systems 项目源码 文件源码
def test_read_style_iter(tmpdir):
    '''
    Test if cell styles are read properly in iter mode.
    '''
    tmpdir.chdir()
    from openpyxl import Workbook
    from openpyxl.styles import Style, Font

    FONT_NAME = "Times New Roman"
    FONT_SIZE = 15
    ft = Font(name=FONT_NAME, size=FONT_SIZE)

    wb = Workbook()
    ws = wb.worksheets[0]
    cell = ws.cell('A1')
    cell.style = Style(font=ft)

    xlsx_file = "read_only_styles.xlsx"
    wb.save(xlsx_file)

    wb_iter = load_workbook(xlsx_file, read_only=True)
    ws_iter = wb_iter.worksheets[0]
    cell = ws_iter['A1']

    assert cell.style.font == ft
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号