changeset 64:d644c13b8cb2

composite run to_str() with children return by children() - It visited children given by child_names. - children() is used to replace child_names.
author Thinker K.F. Li <thinker@codemud.net>
date Tue, 28 Jun 2011 13:36:39 +0800
parents 21d9b6773242
children ce1d5a058d5a
files paraspace/dexfile.py paraspace/tests/dexfile_test.py
diffstat 2 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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: \
--- 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