This is an offside offer. This is a little cool. Caution emptor!
First write a function to create a string representation of the cluster. You will need to write unit tests to make sure that this function works in all cases. The format can be either plain or XML (not very human-friendly, but usually easy to work with hierarchical data). You can call this function by passing to the cluster: string_representation(cluster) .
Secondly, write a variant of this to generate the same output without transmission in a real cluster. Something like util.test.generate_string_representation('child1', 'child2') .
Third, modify your unit test statements to compare the output of string_representation(cluster) with generate_string_representation('child1', 'child2') , as appropriate.
actual = string_representation(f(*args, **kwargs)) expected = generate_string_representation('child1', 'child2') self.assertEqual(actual, expected)
Make sure that both string functions use the same mechanism to format the output. You do not want to end up chasing the smallest line differences.
Told you it's pretty hacks. I hope others have better answers.
source share