def test_good_encoding(): try: # Python 2 pound = unichr(163) except NameError: # Python 3 pound = chr(163) test_string = ('Compound Value (' + pound + ')').encode('latin1') lat_book = Workbook(encoding='latin1') lat_sheet = lat_book.get_active_sheet() lat_sheet.cell('A1').value = test_string
def test_write_regular_float(): float_value = 1.0 / 3.0 book = Workbook() sheet = book.get_active_sheet() sheet.cell("A1").value = float_value dest_filename = os.path.join(TMPDIR, 'float_read_write_issue.xlsx') book.save(dest_filename) validate_archive(dest_filename) test_book = load_workbook(dest_filename) test_sheet = test_book.get_active_sheet() eq_(test_sheet.cell("A1").value, float_value)
def test_write_regular_date(): today = datetime.datetime(2010, 1, 18, 14, 15, 20, 1600) book = Workbook() sheet = book.get_active_sheet() sheet.cell("A1").value = today dest_filename = os.path.join(TMPDIR, 'date_read_write_issue.xlsx') book.save(dest_filename) validate_archive(dest_filename) test_book = load_workbook(dest_filename) test_sheet = test_book.get_active_sheet() eq_(test_sheet.cell("A1").value, today)
def test_roundtrip(self): wb = Workbook() ws = wb.get_active_sheet() for address in ('A1', 'D52', 'X11'): eq_(ws.point_pos(*ws.cell(address).anchor), coordinate_from_string(address))
def test_point(self): wb = Workbook() ws = wb.get_active_sheet() eq_(ws.point_pos(top=40, left=150), ('C', 3))
def test_get_active_sheet(): wb = Workbook() active_sheet = wb.get_active_sheet() eq_(active_sheet, wb.worksheets[0])