def test_findgarbage(self):
        """Test garbage annotation.
        """
        foo = Foo()
        bar = Bar()

        idfoo = id(foo)
        idbar = id(bar)

        foo.next = bar
        bar.prev = foo

        del foo
        del bar

        gb = GarbageGraph()

        self.assertEqual(gb.count, len(gc.garbage))
        self.assert_(gb.count >= 2, gb.count)

        gfoo = [x for x in gb.metadata if x.id == idfoo]
        self.assertEqual(len(gfoo), 1)
        gfoo = gfoo[0]
        self.assertEqual(gfoo.type, 'Foo')
        self.assert_(gfoo.size > 0, gfoo.size)
        self.assertNotEqual(gfoo.str, '')

        gbar = [x for x in gb.metadata if x.id == idbar]
        self.assertEqual(len(gbar), 1)
        gbar = gbar[0]
        self.assertEqual(gbar.type, 'Bar')
        self.assert_(gbar.size > 0, gbar.size)
        self.assertNotEqual(gbar.str, '')
dataset/ETHPy150Open pympler/pympler/test/gui/test_garbage.py/GarbageTestCase.test_findgarbage/original