def test_issue_51_normal_dict_in_records(self): from pyexcel.utils import yield_from_records records = [] orderred_dict = {} orderred_dict.update({"Zebra": 10}) orderred_dict.update({"Hippo": 9}) orderred_dict.update({"Monkey": 8}) records.append(orderred_dict) orderred_dict2 = {} orderred_dict2.update({"Zebra": 1}) orderred_dict2.update({"Hippo": 2}) orderred_dict2.update({"Monkey": 3}) records.append(orderred_dict2) array = list(yield_from_records(records)) expected = [['Hippo', 'Monkey', 'Zebra'], [9, 8, 10], [2, 3, 1]] self.assertEqual(array, expected)
def test_issue_51_orderred_dict_in_records(self): from pyexcel.utils import yield_from_records records = [] orderred_dict = OrderedDict() orderred_dict.update({"Zebra": 10}) orderred_dict.update({"Hippo": 9}) orderred_dict.update({"Monkey": 8}) records.append(orderred_dict) orderred_dict2 = OrderedDict() orderred_dict2.update({"Zebra": 1}) orderred_dict2.update({"Hippo": 2}) orderred_dict2.update({"Monkey": 3}) records.append(orderred_dict2) array = list(yield_from_records(records)) expected = [['Zebra', 'Hippo', 'Monkey'], [10, 9, 8], [1, 2, 3]] self.assertEqual(array, expected)
def get_data(self): from pyexcel.utils import yield_from_records return {DEFAULT_SHEET_NAME: yield_from_records(self.records)}