Skip to content

Commit 3b2da5b

Browse files
committed
🔨 code refactoring
1 parent 241cbe7 commit 3b2da5b

File tree

4 files changed

+15
-7
lines changed

4 files changed

+15
-7
lines changed

changelog.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1+
name: pyexcel-xlsxw
2+
organisation: pyexcel
13
releases:
4+
- changes:
5+
- action: Updated
6+
details:
7+
- 'New style xlsx plugins, promoted by pyexcel-io v0.6.0.'
8+
date: tbd
9+
version: 0.6.0
210
- changes:
311
- action: updated
412
details:

pyexcel-xlsxw.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ test_dependencies:
1313
- pyexcel-xls
1414
- pyexcel-xlsx
1515
description: A wrapper library to write data in xlsx and xlsm format
16+
moban_command: false

pyexcel_xlsxw/xlsxw.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,17 @@ def __init__(
5959
"""
6060
if "single_sheet_in_book" in keywords:
6161
keywords.pop("single_sheet_in_book")
62-
self._native_book = xlsxwriter.Workbook(
62+
self.xlsx_book = xlsxwriter.Workbook(
6363
file_alike_object, options=keywords
6464
)
6565

6666
def create_sheet(self, name):
67-
sheet = self._native_book.add_worksheet(name)
67+
sheet = self.xlsx_book.add_worksheet(name)
6868
return XLSXSheetWriter(sheet)
6969

7070
def close(self):
7171
"""
7272
This call actually save the file
7373
"""
74-
self._native_book.close()
75-
self._native_book = None
74+
self.xlsx_book.close()
75+
self.xlsx_book = None

tests/test_writer.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import os
22

33
from base import PyexcelHatWriterBase, PyexcelWriterBase
4-
from pyexcel_xls import xlsr as xls
4+
from pyexcel_xls import get_data
55

66
from pyexcel_xlsxw import xlsxw as xlsx
77

@@ -18,8 +18,7 @@ def test_write_book(self):
1818
writer.write(self.content)
1919
writer.close()
2020
reader = xls.XLSBook()
21-
reader.open(self.testfile)
22-
content = reader.read_all()
21+
content = get_data(self.testfile)
2322
for key in content.keys():
2423
content[key] = list(content[key])
2524
assert content == self.content

0 commit comments

Comments
 (0)