0

I have a piece of code which outputs a list of named tuples - something like this:

for entry in info:
    my_tuple = namedtuple('some_info', ['name', 'age'])
    list_of_tuples.append(some_info(info.name, info.age))

where info contains the name and age as well as other info which is not needed. I want to mock this to check the response using something that works like this:

self.assertEqual(list_of_tuples, "Some string containing the tuple output")

but this doesn't work as the output of list_of_tuples isn't a string. What method can I try to mock a full named tuple output?

JJH
  • 1
  • 2

0 Answers0