On 24 January 2013 12:03, Michael Hanselmann <[email protected]> wrote: > 2013/1/23 Bernardo Dal Seno <[email protected]>: >> On 21 January 2013 16:23, Michael Hanselmann <[email protected]> wrote: >>> This patch factorizes “_RunXmList” and adds some tests. >> >> Nice work, thank you. Only, I'm not sure about the fact that the tests >> contain parts of the data files, as they check the parsed results and >> compare them with hard-coded constants. Wouldn't it be better if the >> content of the data files was put in a list, as you did for >> testWrongLineFormat()? in this way it would be easier to keep the code >> in sync with the data. I don't mind the duplication as much as the >> distance between the two things to be kept sync. > > testWrongLineFormat uses made-up data, specifically for detecting > parsing errors. We already use the concept of having test data in > dedicated files in other places, for example for tests regarding > parsing /proc/drbd. If Xen were to change the output format, we can > simply add a new data file. This is much easier than making sure data > in Python code is the same byte-by-byte. Having to keep data and code > in sync is unfortunate, but necessary.
Thank you for the convincing explanation. LGTM! Bernardo
