This repository has been archived by the owner on May 4, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 283
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #77 from lelit/master
Fix #76: support Python 3, returning a bytes value instead of a str one
- Loading branch information
Showing
2 changed files
with
15 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,24 @@ | ||
# coding:utf-8 | ||
|
||
from io import BytesIO | ||
import unittest | ||
|
||
from xlwt import BIFFRecords | ||
import xlwt | ||
|
||
class TestSharedStringTable(unittest.TestCase): | ||
def test_shared_string_table(self): | ||
expected_result = b'\xfc\x00\x11\x00\x01\x00\x00\x00\x01\x00\x00\x00\x03\x00\x01\x1e\x04;\x04O\x04' | ||
string_record = BIFFRecords.SharedStringTable(encoding='cp1251') | ||
string_record = xlwt.BIFFRecords.SharedStringTable(encoding='cp1251') | ||
string_record.add_str(u'Оля') | ||
self.assertEqual(expected_result, string_record.get_biff_record()) | ||
|
||
class TestIntersheetsRef(unittest.TestCase): | ||
def test_intersheets_ref(self): | ||
book = xlwt.Workbook() | ||
sheet_a = book.add_sheet('A') | ||
sheet_a.write(0, 0, 'A1') | ||
sheet_a.write(0, 1, 'A2') | ||
sheet_b = book.add_sheet('B') | ||
sheet_b.write(0, 0, xlwt.Formula("'A'!$A$1&'A'!$A$2")) | ||
out = BytesIO() | ||
book.save(out) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters