Esempio n. 1
0
 def test_create_simple_xls(self):
     wb, _ = self.create_simple_xls()
     wb.save(in_tst_output_dir('simple.xls'))
     self.assertTrue(
         filecmp.cmp(in_tst_dir('simple.xls'),
                     in_tst_output_dir('simple.xls'),
                     shallow=False))
Esempio n. 2
0
    def test_create_mini_xls(self):
        book = xlwt.Workbook()
        sheet = book.add_sheet('xlwt was here')
        book.save(in_tst_output_dir('mini.xls'))

        self.assertTrue(filecmp.cmp(in_tst_dir('mini.xls'),
                                    in_tst_output_dir('mini.xls'),
                                    shallow=False))
Esempio n. 3
0
    def test_create_mini_xls(self):
        book = xlwt.Workbook()
        sheet = book.add_sheet('xlwt was here')
        book.save(in_tst_output_dir('mini.xls'))

        self.assertTrue(filecmp.cmp(in_tst_dir('mini.xls'),
                                    in_tst_output_dir('mini.xls'),
                                    shallow=False))
Esempio n. 4
0
 def test_create_bitmap_from_file(self):
     book = xlwt.Workbook()
     sheet = book.add_sheet('bitmap test')
     
     sheet.insert_bitmap("tests/python.bmp", 1, 1)
     
     book.save(in_tst_output_dir('bitmaps.xls'))
     
     self.assertTrue(filecmp.cmp(in_tst_dir('bitmaps.xls'),
                                 in_tst_output_dir('bitmaps.xls'),
                                 shallow=False))
Esempio n. 5
0
 def test_create_less_simple_xls(self):
     self.create_simple_xls(filename='less_simple.xls',
                            more_content=[[
                                u'A{0}'.format(i),
                                u'Zażółć gęślą jaźń {0} {1}'.format(
                                    i, LOREM_IPSUM),
                            ] for idx, i in enumerate(range(1000, 1050))])
     self.assertTrue(
         filecmp.cmp(in_tst_dir('less_simple.xls'),
                     in_tst_output_dir('less_simple.xls'),
                     shallow=False))
Esempio n. 6
0
 def test_create_bitmap_from_file(self):
     book = xlwt.Workbook()
     sheet = book.add_sheet('bitmap test')
     
     sheet.insert_bitmap("tests/python.bmp", 1, 1)
     
     book.save(in_tst_output_dir('bitmaps.xls'))
     
     self.assertTrue(filecmp.cmp(in_tst_dir('bitmaps.xls'),
                                 in_tst_output_dir('bitmaps.xls'),
                                 shallow=False))
Esempio n. 7
0
 def test_create_bitmap_from_memory(self):
     book = xlwt.Workbook()
     sheet = book.add_sheet('bitmap test')
     
     with open ("tests/python.bmp", "rb") as bmpfile:
         bmpdata = bmpfile.read()
         sheet.insert_bitmap_data(bmpdata, 1, 1)
     
     book.save(in_tst_output_dir('bitmaps.xls'))
     
     self.assertTrue(filecmp.cmp(in_tst_dir('bitmaps.xls'),
                                 in_tst_output_dir('bitmaps.xls'),
                                 shallow=False))
Esempio n. 8
0
 def test_create_bitmap_from_memory(self):
     book = xlwt.Workbook()
     sheet = book.add_sheet('bitmap test')
     
     with open ("tests/python.bmp", "rb") as bmpfile:
         bmpdata = bmpfile.read()
         sheet.insert_bitmap_data(bmpdata, 1, 1)
     
     book.save(in_tst_output_dir('bitmaps.xls'))
     
     self.assertTrue(filecmp.cmp(in_tst_dir('bitmaps.xls'),
                                 in_tst_output_dir('bitmaps.xls'),
                                 shallow=False))
Esempio n. 9
0
 def test_create_less_simple_xls(self):
     wb, ws = self.create_simple_xls()
     more_content = [[
         u'A{0}'.format(i),
         u'Zażółć gęślą jaźń {0} {1}'.format(i, LOREM_IPSUM),
     ] for idx, i in enumerate(range(1000, 1050))]
     for r_idx, content_row in enumerate(more_content, 3):
         for c_idx, cell in enumerate(content_row):
             ws.write(r_idx, c_idx, cell)
     wb.save(in_tst_output_dir('less_simple.xls'))
     self.assertTrue(
         filecmp.cmp(in_tst_dir('less_simple.xls'),
                     in_tst_output_dir('less_simple.xls'),
                     shallow=False))
Esempio n. 10
0
 def test_create_less_simple_xls(self):
     self.create_simple_xls(
         filename='less_simple.xls',
         more_content=[
             [
                 u'A{0}'.format(i),
                 u'Zażółć gęślą jaźń {0} {1}'.format(i, LOREM_IPSUM),
             ]
             for idx, i in enumerate(range(1000, 1050))
         ]
     )
     self.assertTrue(filecmp.cmp(in_tst_dir('less_simple.xls'),
                                 in_tst_output_dir('less_simple.xls'),
                                 shallow=False))
Esempio n. 11
0
 def test_create_less_simple_xls(self):
     wb, ws = self.create_simple_xls()
     more_content=[
         [
             u'A{0}'.format(i),
             u'Zażółć gęślą jaźń {0} {1}'.format(i, LOREM_IPSUM),
         ]
         for idx, i in enumerate(range(1000, 1050))
     ]
     for r_idx, content_row in enumerate(more_content, 3):
         for c_idx, cell in enumerate(content_row):
             ws.write(r_idx, c_idx, cell)
     wb.save(in_tst_output_dir('less_simple.xls'))
     self.assertTrue(filecmp.cmp(in_tst_dir('less_simple.xls'),
                                 in_tst_output_dir('less_simple.xls'),
                                 shallow=False))
Esempio n. 12
0
 def test_example_xls(self):
     self.create_example_xls(in_tst_output_dir(EXAMPLE_XLS))
     self.assertTrue(filecmp.cmp(in_tst_dir(EXAMPLE_XLS),
                                 in_tst_output_dir(EXAMPLE_XLS),
                                 shallow=False))
Esempio n. 13
0
 def test_example_xls(self):
     create_example_xls(in_tst_output_dir(EXAMPLE_XLS))
     self.assertTrue(filecmp.cmp(in_tst_dir(EXAMPLE_XLS),
                                 in_tst_output_dir(EXAMPLE_XLS),
                                 shallow=False))
Esempio n. 14
0
 def test_create_simple_xls(self):
     self.create_simple_xls()
     self.assertTrue(filecmp.cmp(in_tst_dir('simple.xls'),
                                 in_tst_output_dir('simple.xls'),
                                 shallow=False))
Esempio n. 15
0
 def test_create_nan_xls(self):
     self.create_nan_xls()
     self.assertTrue(filecmp.cmp(in_tst_dir('nan.xls'),
                                 in_tst_output_dir('nan.xls'),
                                 shallow=False))