def test_creating_transaction_data_from_row_and_header_maps_channel_and_services(self): header = ["Channel Descriptions", "", "Transaction", "Apr 2012"] row = ["Fully Digital", "SORN", "V-V11 SORN EVL", 10] assert_that(create_transaction_data(header, row), has_items( ["2012-04-01T00:00:00+00:00", "sorn", "fully-digital", "V-V11 SORN EVL", 10], ))
def test_creating_transaction_data_from_row_and_header(self): header = ["Channel Descriptions", "", "Transaction", "Apr 2012", "Mar 2013", "May 2013"] row = ["Manual", "Relicensing", "V-V890 Another transaction", 1, 2, 3] assert_that(create_transaction_data(header, row), has_items( ["2012-04-01T00:00:00+00:00", "tax-disc", "manual", "V-V890 Another transaction", 1], ["2013-03-01T00:00:00+00:00", "tax-disc", "manual", "V-V890 Another transaction", 2], ["2013-05-01T00:00:00+00:00", "tax-disc", "manual", "V-V890 Another transaction", 3], ))
def volumetrics(sheets): sheet = list(list(sheets)[2]) yield ["_timestamp", "service", "channel", "transaction", "volume"] header, rows = extract_transaction_rows(remove_summary_columns(sheet)) for row in rows: for data in create_transaction_data(header, row): yield data