33 This file keeps all fixes for issues found
44
55"""
6- import os
76import datetime
7+ import os
88from textwrap import dedent
99from unittest import TestCase
10+
1011import pyexcel as pe
1112
1213from pyexcel_xlsxw import save_data
1314
1415
1516class TestBugFix (TestCase ):
16-
1717 def test_pyexcel_issue_5 (self ):
1818 """pyexcel issue #5
1919
2020 datetime is not properly parsed
2121 """
22- s = pe .load (os . path . join ( "tests" ,
23- "test-fixtures" ,
24- "test-date-format.xls" ) )
22+ s = pe .load (
23+ os . path . join ( "tests" , "test-fixtures" , "test-date-format.xls" )
24+ )
2525 s .save_as ("issue5.xlsx" )
2626 s2 = pe .load ("issue5.xlsx" )
2727 assert s [0 , 0 ] == datetime .datetime (2015 , 11 , 11 , 11 , 12 , 0 )
@@ -33,21 +33,21 @@ def test_pyexcel_issue_8_with_physical_file(self):
3333 formular got lost
3434 """
3535 tmp_file = "issue_8_save_as.xlsx"
36- s = pe .load (os .path .join ("tests" ,
37- "test-fixtures" ,
38- "test8.xlsx" ))
36+ s = pe .load (os .path .join ("tests" , "test-fixtures" , "test8.xlsx" ))
3937 s .save_as (tmp_file )
4038 s2 = pe .load (tmp_file )
4139 self .assertEqual (str (s ), str (s2 ))
42- content = dedent ("""
40+ content = dedent (
41+ """
4342 CNY:
4443 +----------+----------+------+---+-------+
4544 | 01/09/13 | 02/09/13 | 1000 | 5 | 13.89 |
4645 +----------+----------+------+---+-------+
4746 | 02/09/13 | 03/09/13 | 2000 | 6 | 33.33 |
4847 +----------+----------+------+---+-------+
4948 | 03/09/13 | 04/09/13 | 3000 | 7 | 58.33 |
50- +----------+----------+------+---+-------+""" ).strip ("\n " )
49+ +----------+----------+------+---+-------+"""
50+ ).strip ("\n " )
5151 self .assertEqual (str (s2 ), content )
5252 os .unlink (tmp_file )
5353
@@ -57,23 +57,22 @@ def test_pyexcel_issue_8_with_memory_file(self):
5757 formular got lost
5858 """
5959 tmp_file = "issue_8_save_as.xlsx"
60- f = open (os .path .join ("tests" ,
61- "test-fixtures" ,
62- "test8.xlsx" ),
63- "rb" )
64- s = pe .load_from_memory ('xlsx' , f .read ())
60+ f = open (os .path .join ("tests" , "test-fixtures" , "test8.xlsx" ), "rb" )
61+ s = pe .load_from_memory ("xlsx" , f .read ())
6562 s .save_as (tmp_file )
6663 s2 = pe .load (tmp_file )
6764 self .assertEqual (str (s ), str (s2 ))
68- content = dedent ("""
65+ content = dedent (
66+ """
6967 CNY:
7068 +----------+----------+------+---+-------+
7169 | 01/09/13 | 02/09/13 | 1000 | 5 | 13.89 |
7270 +----------+----------+------+---+-------+
7371 | 02/09/13 | 03/09/13 | 2000 | 6 | 33.33 |
7472 +----------+----------+------+---+-------+
7573 | 03/09/13 | 04/09/13 | 3000 | 7 | 58.33 |
76- +----------+----------+------+---+-------+""" ).strip ("\n " )
74+ +----------+----------+------+---+-------+"""
75+ ).strip ("\n " )
7776 self .assertEqual (str (s2 ), content )
7877 os .unlink (tmp_file )
7978
@@ -86,8 +85,9 @@ def test_workbook_options(self):
8685 cell_content = "= Hello World ="
8786 tmp_file = "workbook_options.xlsx"
8887 data = {"Sheet 1" : [[cell_content ]]}
89- save_data (tmp_file , data , strings_to_formulas = False ,
90- library = 'pyexcel-xlsxw' )
88+ save_data (
89+ tmp_file , data , strings_to_formulas = False , library = "pyexcel-xlsxw"
90+ )
9191 sheet = pe .get_sheet (file_name = tmp_file )
9292 self .assertEqual (sheet [0 ][0 ], cell_content )
9393 os .unlink (tmp_file )
0 commit comments