Rev 180: fix the test-suite fallout from the previous change. in http://bazaar.launchpad.net/~meliae-dev/meliae/trunk

John Arbash Meinel john at arbash-meinel.com
Thu Aug 5 20:54:31 BST 2010


At http://bazaar.launchpad.net/~meliae-dev/meliae/trunk

------------------------------------------------------------
revno: 180
revision-id: john at arbash-meinel.com-20100805195417-kg7nb6y4p24yu5x7
parent: john at arbash-meinel.com-20100805192918-o021ullgt8x7esyd
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: trunk
timestamp: Thu 2010-08-05 14:54:17 -0500
message:
  fix the test-suite fallout from the previous change.
  
  turns out there was a dict we weren't collapsing, that started getting
  collapsed after the change.
  However, it is a reasonable thing to be doing, since real-world is
  unlikely to have the same problem.
-------------- next part --------------
=== modified file 'meliae/tests/test_loader.py'
--- a/meliae/tests/test_loader.py	2010-07-31 04:23:53 +0000
+++ b/meliae/tests/test_loader.py	2010-08-05 19:54:17 +0000
@@ -223,7 +223,7 @@
 class TestMemObj(tests.TestCase):
 
     def test_to_json(self):
-        manager = loader.load(_example_dump, show_prog=False)
+        manager = loader.load(_example_dump, show_prog=False, collapse=False)
         objs = manager.objs.values()
         objs.sort(key=lambda x:x.address)
         expected = [
@@ -243,15 +243,13 @@
 
     def test_compute_parents(self):
         manager = loader.load(_example_dump, show_prog=False)
-        manager.compute_parents()
         objs = manager.objs
         self.assertEqual((), objs[1].parents)
-        self.assertEqual([1, 8], objs[2].parents)
         self.assertEqual([1, 3], objs[3].parents)
-        self.assertEqual([2, 3, 7], objs[4].parents)
-        self.assertEqual([2, 3, 7], objs[5].parents)
-        self.assertEqual([2], objs[6].parents)
-        self.assertEqual([2], objs[7].parents)
+        self.assertEqual([3, 7, 8], objs[4].parents)
+        self.assertEqual([3, 7, 8], objs[5].parents)
+        self.assertEqual([8], objs[6].parents)
+        self.assertEqual([8], objs[7].parents)
         self.assertEqual((), objs[8].parents)
 
     def test_compute_referrers(self):
@@ -271,19 +269,18 @@
         finally:
             warn.trap_warnings(old_func)
         self.assertEqual((), objs[1].parents)
-        self.assertEqual([1, 8], objs[2].parents)
         self.assertEqual([1, 3], objs[3].parents)
-        self.assertEqual([2, 3, 7], objs[4].parents)
-        self.assertEqual([2, 3, 7], objs[5].parents)
-        self.assertEqual([2], objs[6].parents)
-        self.assertEqual([2], objs[7].parents)
+        self.assertEqual([3, 7, 8], objs[4].parents)
+        self.assertEqual([3, 7, 8], objs[5].parents)
+        self.assertEqual([8], objs[6].parents)
+        self.assertEqual([8], objs[7].parents)
         self.assertEqual((), objs[8].parents)
 
     def test_compute_total_size(self):
         manager = loader.load(_example_dump, show_prog=False)
         objs = manager.objs
-        manager.compute_total_size(objs[1])
-        self.assertEqual(261, objs[1].total_size)
+        manager.compute_total_size(objs[8])
+        self.assertEqual(257, objs[8].total_size)
 
     def test_compute_total_size_missing_ref(self):
         lines = list(_example_dump)
@@ -394,16 +391,16 @@
 
     def test_summarize_refs(self):
         manager = loader.load(_example_dump, show_prog=False)
-        summary = manager.summarize(manager[2])
-        # Note that the dict itself is not excluded from the summary
-        self.assertEqual(['dict', 'int', 'str', 'tuple'],
+        summary = manager.summarize(manager[8])
+        # Note that the module is included in the summary
+        self.assertEqual(['int', 'module', 'str', 'tuple'],
                          sorted(summary.type_summaries.keys()))
-        self.assertEqual(197, summary.total_size)
+        self.assertEqual(257, summary.total_size)
 
     def test_summarize_excluding(self):
         manager = loader.load(_example_dump, show_prog=False)
-        summary = manager.summarize(manager[2], excluding=[4, 5])
+        summary = manager.summarize(manager[8], excluding=[4, 5])
         # No ints when they are explicitly filtered
-        self.assertEqual(['dict', 'str', 'tuple'],
+        self.assertEqual(['module', 'str', 'tuple'],
                          sorted(summary.type_summaries.keys()))
-        self.assertEqual(173, summary.total_size)
+        self.assertEqual(233, summary.total_size)



More information about the bazaar-commits mailing list