class DirectClass:

    def __init__(self):
        self.data_groups = dict
self.consumers_list = list

def direct(self):
    """
        routes data in self.data_groups to
        consumers in self.consumers_list
        """
for data_type, group in list(self.data_groups.items()):
    for consumer_name in self.consumers_list[data_type]:
        for record in group:
            consumer = self.get_consumer(consumer_name, record)
consumer_output = consumer.do_something()
return True


class TestDirect(DirectClass):

    def __init__(self):
        DirectClass.__init__(self)

def direct(self):
    output_list = []
for data_type, group in list(self.data_groups.items()):
    output_list.append(data_type)
output_list.append(group)
for consumer_name in self.consumers_list[data_type]:
    for record in group:
        output_list.append(list(record.values())[0])
return output_list
Unit testing a method that iterates through loops