def test_fonts(self): self.worksheet.cell('A1').style.font.size = 12 self.worksheet.cell('A1').style.font.bold = True w = StyleWriter(self.workbook) w._write_fonts() eq_(get_xml(w._root), '<?xml version=\'1.0\' encoding=\'UTF-8\'?><styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><fonts count="2"><font><sz val="11" /><color theme="1" /><name val="Calibri" /><family val="2" /><scheme val="minor" /></font><font><sz val="12" /><color rgb="FF000000" /><name val="Calibri" /><family val="2" /><b /></font></fonts></styleSheet>')
def test_fonts_with_underline(self): st = Style( font=Font(size=12, bold=True, underline=Font.UNDERLINE_SINGLE)) self.worksheet.cell('A1').style = st w = StyleWriter(self.workbook) w._write_fonts() xml = get_xml(w._root) diff = compare_xml( xml, """ <styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"> <fonts count="2"> <font> <sz val="11" /> <color theme="1" /> <name val="Calibri" /> <family val="2" /> <scheme val="minor" /> </font> <font> <sz val="12.0" /> <color rgb="00000000" /> <name val="Calibri" /> <family val="2" /> <b /> <u /> </font> </fonts> </styleSheet> """) assert diff is None, diff
def test_fonts(self): self.worksheet.cell('A1').style.font.size = 12 self.worksheet.cell('A1').style.font.bold = True w = StyleWriter(self.workbook) w._write_fonts() xml = get_xml(w._root) diff = compare_xml(xml, """ <styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"> <fonts count="2"> <font> <sz val="11" /> <color theme="1" /> <name val="Calibri" /> <family val="2" /> <scheme val="minor" /> </font> <font> <sz val="12" /> <color rgb="FF000000" /> <name val="Calibri" /> <family val="2" /> <b /> </font> </fonts> </styleSheet> """) assert diff is None, diff
def test_fonts_with_underline(self): st = Style(font=Font(size=12, bold=True, underline=Font.UNDERLINE_SINGLE)) self.worksheet.cell('A1').style = st w = StyleWriter(self.workbook) w._write_fonts() xml = get_xml(w._root) diff = compare_xml(xml, """ <styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"> <fonts count="2"> <font> <sz val="11" /> <color theme="1" /> <name val="Calibri" /> <family val="2" /> <scheme val="minor" /> </font> <font> <sz val="12.0" /> <color rgb="00000000" /> <name val="Calibri" /> <family val="2" /> <b /> <u /> </font> </fonts> </styleSheet> """) assert diff is None, diff
def test_fonts(self): self.worksheet.cell('A1').style.font.size = 12 self.worksheet.cell('A1').style.font.bold = True w = StyleWriter(self.workbook) w._write_fonts() xml = get_xml(w._root) diff = compare_xml( xml, """ <styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"> <fonts count="2"> <font> <sz val="11" /> <color theme="1" /> <name val="Calibri" /> <family val="2" /> <scheme val="minor" /> </font> <font> <sz val="12" /> <color rgb="FF000000" /> <name val="Calibri" /> <family val="2" /> <b /> </font> </fonts> </styleSheet> """) assert diff is None, diff
def test_write_cell_xfs_1(self): self.worksheet.cell('A1').style.font.size = 12 w = StyleWriter(self.workbook) ft = w._write_fonts() nft = w._write_number_formats() w._write_cell_xfs(nft, ft, {}, {}) xml = get_xml(w._root) assert 'applyFont="1"' in xml assert 'applyFill="1"' not in xml assert 'applyBorder="1"' not in xml assert 'applyAlignment="1"' not in xml