11import pytest
2+ from pathlib import Path
3+ import networkx as nx
24
35from gephipy import gephipy
46
5- import networkx as nx
7+ # Must be imported after gephipy
68from org .gephi .layout .plugin .forceAtlas2 import ForceAtlas2Builder
79from org .gephi .layout .plugin .random import Random
810from org .gephi .layout .plugin .noverlap import NoverlapLayoutBuilder
1315from org .gephi .appearance .plugin .palette import PaletteManager
1416from org .gephi .statistics .plugin import GraphDistance , Modularity
1517
18+
1619def test_scenario ():
17-
1820 #
1921 # Create a workspace
2022 #
2123 workspace = gephipy .create_workspace ()
2224
23- #
25+
2426 # Create a random graph with NetworkX
25- #
2627 graphX = nx .erdos_renyi_graph (500 ,0.01 )
2728 gephipy .networkx_to_gephi (workspace , graphX )
2829 graphModel = gephipy .get_graph_model (workspace )
@@ -65,7 +66,6 @@ def test_scenario():
6566 partition .setColors (graphModel .getGraph (), palette .getColors ())
6667 appearanceController .transform (colorPartition )
6768
68-
6969 #
7070 # Run Layouts
7171 #
@@ -94,5 +94,18 @@ def test_scenario():
9494 #
9595 # Export your graph
9696 #
97-
98- gephipy .export_gexf (workspace , "my-gephi-graph.gexf" )
97+ gephipy .export_gexf (workspace , "test-export-graph.gexf" )
98+ file = Path ("./test-export-graph.gexf" )
99+ assert file .is_file () == True
100+
101+ gephipy .export_svg (workspace , "test-export-graph.svg" )
102+ file = Path ("./test-export-graph.svg" )
103+ assert file .is_file () == True
104+
105+ gephipy .export_pdf (workspace , "test-export-graph.pdf" )
106+ file = Path ("./test-export-graph.pdf" )
107+ assert file .is_file () == True
108+
109+ gephipy .export_png (workspace , "test-export-graph.png" )
110+ file = Path ("./test-export-graph.png" )
111+ assert file .is_file () == True
0 commit comments