def test_prune(self):
        """Test pruning of reference graph.
        """
        foo = Foo()
        bar = Bar()

        foo.parent = foo
        foo.leaf = bar

        idb = id(bar)

        del foo
        del bar

        gb1 = GarbageGraph()
        gb2 = GarbageGraph(reduce=True)

        self.assertEqual(gb1.count, gb2.count)
        self.assertTrue(gb2.num_in_cycles > gb1.count)
        # Only foo and foo's __dict__ should be in the cycle
        self.assertEqual(gb2.num_in_cycles, 2)

        gbar = [x for x in gb1.metadata if x.id == idb]
        self.assertEqual(len(gbar), 1)
        gbar = [x for x in gb2.metadata if x.id == idb]
        self.assertEqual(len(gbar), 0)
dataset/ETHPy150Open pympler/pympler/test/gui/test_garbage.py/GarbageTestCase.test_prune/swapped operands of `>`