Loris Bennett wrote at 2022-3-11 07:40 +0100: > ... I want to test the parsing ... >Sorry if I was unclear but my question is: > >Given that the return value from Popen is a Popen object and given that >the return value from reading a file is a single string or maybe a list >of strings, what should the common format for the argument which is >passed to the actual parsing function be?
What methods (of its input argument) does the parsing use? If it uses `Popen` methods, then you pass a `POpen` object; if it uses only (typical) file methods, then you pass a file object; if it assumes its input to be a (line) interator, you pass a (line) iterator (such as a "file" object). I would design the parsing that it makes as few assumptions about its input as possible -- to ease testing and increase the chance for reuse. That said, I would not design it to work with `Popen` objects but likely to have a line iterator as input. -- https://mail.python.org/mailman/listinfo/python-list