def test_build_tree_from_context(self):
        from furious.context import _local
        from furious.context.context import Context
        from furious.marker_tree.marker import Marker
        from furious.marker_tree.graph_analysis import tree_graph_growth

        from furious.tests.marker_tree import dummy_success_callback

        context = Context()

        for arg in xrange(23):
            context.add(target=dummy_success_callback,
                        args=[arg])

        _local.get_local_context().registry.append(context)

        root_marker = Marker.make_marker_tree_for_context(context)

        root_marker.persist()
        # Plus one, because of the empty context.
        self.assertEqual(root_marker.count_nodes(), tree_graph_growth(23))
    def test_count_nodes(self):
        """Ensure Marker.count_nodes

        """
        from furious.context import _local
        from furious.context.context import Context
        from furious.marker_tree.marker import Marker

        from furious.tests.marker_tree import dummy_success_callback

        context = Context()

        context.add(target=dummy_success_callback,
                    args=[1])

        _local.get_local_context().registry.append(context)

        root_marker = Marker.make_marker_tree_for_context(context)

        root_marker.persist()
        # Plus one, because of the empty context.
        self.assertEqual(root_marker.count_nodes(), 2)