# HG changeset patch # User Thinker K.F. Li # Date 1309239399 -28800 # Node ID d644c13b8cb2b2060a310d20d4945fcd27d80ac5 # Parent 21d9b6773242b8b7c69bf7a0a9de815733a49014 composite run to_str() with children return by children() - It visited children given by child_names. - children() is used to replace child_names. diff -r 21d9b6773242 -r d644c13b8cb2 paraspace/dexfile.py --- a/paraspace/dexfile.py Tue Jun 28 13:03:23 2011 +0800 +++ b/paraspace/dexfile.py Tue Jun 28 13:36:39 2011 +0800 @@ -583,7 +583,7 @@ def compute_size(self): children = [getattr(self, child_name) - for child_name in self.child_names] + for child_name in self.children()] child_sizes = [compute_size(child) for child in children] self.data_size = sum(child_sizes) @@ -591,7 +591,7 @@ def to_str(self): child_clazzs = [getattr(self.__class__, child_name) - for child_name in self.child_names] + for child_name in self.children()] children = [getattr(self, child_name) for child_name in self.child_names] child_strs = map(lambda child_clazz, child: \ diff -r 21d9b6773242 -r d644c13b8cb2 paraspace/tests/dexfile_test.py --- a/paraspace/tests/dexfile_test.py Tue Jun 28 13:03:23 2011 +0800 +++ b/paraspace/tests/dexfile_test.py Tue Jun 28 13:36:39 2011 +0800 @@ -354,6 +354,7 @@ dex_raw = dex.to_str() file_raw = file(testdatapath, 'r').read() + print len(dex_raw), len(file_raw) assert dex_raw == file_raw pass