def setUpClass(TestBal): """ Called only once before all tests """ file = join(get_current_path(), 'samples', 'CLM BAL 2017-07-27.xls') wb = open_workbook(filename=file) TestBal.balrecords = readHolding(wb.sheet_by_name('Portfolio Val.')) TestBal.balsummary = readSummary(wb.sheet_by_name('Portfolio Sum.')) file = join(get_current_path(), 'samples', 'CLM GNT 2017-10-25.xls') wb = open_workbook(filename=file) TestBal.gntrecords = readHolding(wb.sheet_by_name('Portfolio Val.')) TestBal.gntsummary = readSummary(wb.sheet_by_name('Portfolio Sum.'))
def testValidateBal2(self): file = join(get_current_path(), 'samples', 'CLM BAL 2018-05-31.xls') records, summary = readFile(file) equityRecords = list(filter(equity, records)) self.assertEqual(len(equityRecords), 26) record = equityRecords[17] self.assertEqual(record['ticker'], '6886 HK') self.assertEqual(record['quantity'], 60000)
def setUpClass(TestDif): """ Called only once before all tests """ file = join(get_current_path(), 'samples', 'CL Franklin DIF 2018-05-28(2nd Revised).xls') wb = open_workbook(filename=file) TestDif.records = readHolding(wb.sheet_by_name('Portfolio Val.')) TestDif.summary = readSummary(wb.sheet_by_name('Portfolio Sum.'))
def testAll(self): file = join(get_current_path(), 'samples', 'CL Franklin DIF 2018-07-24.xls') wb = open_workbook(filename=file) records = readHolding(wb.sheet_by_name('Portfolio Val.')) summary = readSummary(wb.sheet_by_name('Portfolio Sum.')) try: validate(records, summary) except e: self.fail('validation failed ' + e)
def allRecords(): file = join(get_current_path(), 'samples', 'CL Franklin DIF 2018-05-28(2nd Revised).xls') wb = open_workbook(file) return readHolding(wb.sheet_by_name('Portfolio Val.'))
def futuresSection(): file = join(get_current_path(), 'samples', 'CL Franklin DIF 2018-05-28(2nd Revised).xls') ws = open_workbook(filename=file).sheet_by_name('Portfolio Val.') sections = linesToSections(worksheetToLines(ws)) return sections[19]
def getRecordsGnt(): file = join(get_current_path(), 'samples', 'CLM GNT 2017-10-25.xls') return readFile(file)
def getRecordsBal(): file = join(get_current_path(), 'samples', 'CLM BAL 2017-07-27.xls') return readFile(file)
def getRecords(): file = join(get_current_path(), 'samples', 'CL Franklin DIF 2018-05-28(2nd Revised).xls') return readFile(file)