def testReadCSV(self): # Orders orders_lst = readCsvFile('/home/cs416/datasets/hw0/tpch-sf0.1/orders.csv', Orders) for (i, order) in enumerate(orders_lst[0:5]): self.assertEqual(order.o_orderkey, i+1, 'Failed to read orders object from csv') # Lineitem lineitem_lst = readCsvFile('/home/cs416/datasets/hw0/tpch-sf0.1/lineitem.csv', Lineitem) for lineitem in lineitem_lst[0:5]: self.assertEqual(lineitem.l_orderkey, 1, 'Failed to read lineitem object from csv')
def testReadCSV(self): # Orders orders_lst = readCsvFile( '/home/cs416/datasets/hw0/tpch-sf0.1/orders.csv', Orders) for (i, order) in enumerate(orders_lst[0:5]): self.assertEqual(order.o_orderkey, i + 1, 'Failed to read orders object from csv') # Lineitem lineitem_lst = readCsvFile( '/home/cs416/datasets/hw0/tpch-sf0.1/lineitem.csv', Lineitem) for lineitem in lineitem_lst[0:5]: self.assertEqual(lineitem.l_orderkey, 1, 'Failed to read lineitem object from csv')
def testBinary(self): # Get some data orders_lst1 = readCsvFile('/home/cs416/datasets/hw0/tpch-sf0.1/orders.csv', Orders)[0:5] # Write out binary writeBinaryFile('orders.bin', orders_lst1) # Read back in, and compare orders_lst2 = readBinaryFile('orders.bin', Orders) self.assertEqual(len(orders_lst1), len(orders_lst2)) for (o1, o2) in zip(orders_lst1, orders_lst2): self.assertEqual(o1.o_orderkey, o2.o_orderkey, 'Failed to read orders object from binary file')
def testBinary(self): # Get some data orders_lst1 = readCsvFile( '/home/cs416/datasets/hw0/tpch-sf0.1/orders.csv', Orders)[0:5] # Write out binary writeBinaryFile('orders.bin', orders_lst1) # Read back in, and compare orders_lst2 = readBinaryFile('orders.bin', Orders) self.assertEqual(len(orders_lst1), len(orders_lst2)) for (o1, o2) in zip(orders_lst1, orders_lst2): self.assertEqual(o1.o_orderkey, o2.o_orderkey, 'Failed to read orders object from binary file')