예제 #1
0
def test_visualize(add_nodes_mock, add_edges_mock, digraph_mock):
    """Metadata visualize digraph"""
    # Setup
    # plot = Mock(spec_set=graphviz.Digraph)
    # graphviz_mock.Digraph.return_value = plot

    metadata = MagicMock(spec_set=Metadata)

    # Run
    visualization.visualize(metadata, path='output.png')

    # Asserts
    digraph = digraph_mock.return_value
    add_nodes_mock.assert_called_once_with(metadata, digraph, True, True)
    add_edges_mock.assert_called_once_with(metadata, digraph, True, True)

    digraph.render.assert_called_once_with(filename='output', cleanup=True, format='png')
예제 #2
0
    def visualize(self, path=None):
        """Plot metadata usign graphviz.

        Generate a plot using graphviz.
        If a ``path`` is provided save the output into a file.

        Args:
            path (str):
                Output file path to save the plot. It requires a graphviz
                supported extension. If ``None`` do not save the plot and
                just return the ``graphviz.Digraph`` object.
                Defaults to ``None``.
        """
        return visualization.visualize(self, path)
예제 #3
0
파일: dataset.py 프로젝트: surajitdb/SDV
    def visualize(self, path=None, names=True, details=True):
        """Plot metadata usign graphviz.

        Generate a plot using graphviz.
        If a ``path`` is provided save the output into a file.

        Args:
            path (str):
                Output file path to save the plot. It requires a graphviz
                supported extension. If ``None`` do not save the plot and
                just return the ``graphviz.Digraph`` object.
                Defaults to ``None``.
            names (bool):
                Whether to add names to the diagram or not. Defaults to ``True``
        """
        return visualization.visualize(self, path, names=names, details=details)