def test_dates_and_times(self): self._check( View(path.join(test_files, 'datetime.xls'))[0], (datetime(2012, 4, 13, 0, 0), ), (time(12, 54, 37), ), (datetime(2014, 2, 14, 4, 56, 23), ), )
def test_passed_in_class(self): class MySheetView: def __init__(self, book, sheet): self.book, self.sheet = book, sheet view = View(path.join(test_files,'testall.xls'), class_=MySheetView) sheet_view = view[0] self.assertTrue(isinstance(sheet_view, MySheetView)) self.assertTrue(sheet_view.book is view.book) self.assertTrue(sheet_view.sheet is view.book.sheet_by_index(0))
def test_int_index(self): self._check( View(path.join(test_files,'testall.xls'))[0], (u'R0C0', u'R0C1'), (u'R1C0', u'R1C1'), (u'A merged cell', ''), ('', ''), ('', ''), (u'More merged cells', '') )
def load_sales_order_data(location): view = View(location) relevant_data = { 1: 'order_number', 7: 'material_code', 8: 'quantity', 10: 'date', 11: 'issue_date', 12: 'delivery_date', 15: 'net_price', 16: 'net_value' } return _convert_view_to_list_of_dicts(view[0][1:, :], relevant_data)
def load_records(self): view = View(self.location) return self._convert_view_to_list_of_dicts(view[0][1:, :], self.RELEVANT_DATA)
def setUp(self): self.view = View(path.join(test_files, 'testall.xls'))[0]
def test_xlsx(self): self._check( View(path.join(test_files, 'sample.xlsx')), (), )
def test_date(self): self._check( View(path.join(test_files, 'date.xls'))[0], (datetime(2012, 4, 13, 0, 0), ), )