From 4883d62ea51658a66446bb417b6b764b8ccf4a9e Mon Sep 17 00:00:00 2001 From: Sadra Sabouri Date: Sun, 17 Mar 2024 10:46:57 -0700 Subject: [PATCH] move : `gexf_maker` moved to engine tests. --- test/engines/erdos_reyni_gilbert_test.py | 11 +++- test/engines/pyrgg_test.py | 39 +++++++++++- test/graph_gen_test.py | 81 +----------------------- 3 files changed, 51 insertions(+), 80 deletions(-) diff --git a/test/engines/erdos_reyni_gilbert_test.py b/test/engines/erdos_reyni_gilbert_test.py index ea5f42d2..9deb1e13 100644 --- a/test/engines/erdos_reyni_gilbert_test.py +++ b/test/engines/erdos_reyni_gilbert_test.py @@ -228,6 +228,14 @@ >>> gml1 = read_gml("testfile.gml") >>> type(gml1) +>>> #################### gexf_maker #################### +>>> from networkx.readwrite.gexf import read_gexf +>>> random.seed(2) +>>> engine.gen_using(gexf_maker, 'testfile', {'vertices':10, 'probability':0.1}) +5 +>>> gexf1 = read_gexf("testfile.gexf") +>>> type(gexf1) + >>> #################### dot_maker #################### >>> import pydot >>> random.seed(2) @@ -251,6 +259,7 @@ >>> os.remove('testfile.tgf') >>> os.remove('testfile.dl') >>> os.remove('testfile.gml') +>>> os.remove('testfile.gexf') >>> os.remove('testfile.gv') >>> os.remove('logfile.log') -""" \ No newline at end of file +""" diff --git a/test/engines/pyrgg_test.py b/test/engines/pyrgg_test.py index 204c2ec1..64ea9d5b 100644 --- a/test/engines/pyrgg_test.py +++ b/test/engines/pyrgg_test.py @@ -1605,6 +1605,38 @@ >>> gml4 = read_gml("testfile4.gml") >>> type(gml4) +>>> #################### gexf_maker #################### +>>> from networkx.readwrite.gexf import read_gexf +>>> random.seed(2) +>>> engine.gen_using(gexf_maker, 'testfile', {'min_weight':0, 'max_weight':200, 'vertices':10, 'min_edge':0, 'max_edge':2, 'sign':1, 'direct':1, 'self_loop':1, 'multigraph':0}) +7 +>>> gexf1 = read_gexf("testfile.gexf") +>>> type(gexf1) + +>>> random.seed(8) +>>> engine.gen_using(gexf_maker, 'testfile2', {'min_weight':0, 'max_weight':50, 'vertices':30, 'min_edge':0, 'max_edge':4, 'sign':1, 'direct':1, 'self_loop':1, 'multigraph':1}) +35 +>>> gexf2 = read_gexf("testfile2.gexf") +>>> type(gexf2) + +>>> random.seed(20) +>>> engine.gen_using(gexf_maker, 'testfile3', {'min_weight':0, 'max_weight':50, 'vertices':30, 'min_edge':0, 'max_edge':4, 'sign':1, 'direct':0, 'self_loop':1, 'multigraph':1}) +35 +>>> gexf3 = read_gexf("testfile3.gexf") +>>> type(gexf3) + +>>> random.seed(120) +>>> engine.gen_using(gexf_maker, 'testfile4', {'min_weight':0, 'max_weight':50, 'vertices':30, 'min_edge':0, 'max_edge':4, 'sign':1, 'direct':0, 'self_loop':1, 'multigraph':0}) +35 +>>> gexf4 = read_gexf("testfile4.gexf") +>>> type(gexf4) + +>>> random.seed(120) +>>> engine.gen_using(gexf_maker, 'testfile5', {'min_weight':0, 'max_weight':50.2, 'vertices':30, 'min_edge':0, 'max_edge':4, 'sign':1, 'direct':0, 'self_loop':1, 'multigraph':0}) +40 +>>> gexf5 = read_gexf("testfile5.gexf") +>>> type(gexf5) + >>> #################### dot_maker #################### >>> import pydot >>> random.seed(2) @@ -1671,8 +1703,13 @@ >>> os.remove('testfile2.gml') >>> os.remove('testfile3.gml') >>> os.remove('testfile4.gml') +>>> os.remove('testfile.gexf') +>>> os.remove('testfile2.gexf') +>>> os.remove('testfile3.gexf') +>>> os.remove('testfile4.gexf') +>>> os.remove('testfile5.gexf') >>> os.remove('testfile.gv') >>> os.remove('testfile2.gv') >>> os.remove('testfile3.gv') >>> os.remove('logfile.log') -""" \ No newline at end of file +""" diff --git a/test/graph_gen_test.py b/test/graph_gen_test.py index 759dab8f..20541850 100644 --- a/test/graph_gen_test.py +++ b/test/graph_gen_test.py @@ -8,14 +8,13 @@ >>> import json >>> import yaml >>> import pickle ->>> from networkx.readwrite.gexf import read_gexf >>> os.environ["PYRGG_TEST_MODE"] = "1" >>> dimacs_maker({}, {}) Traceback (most recent call last): ... TypeError: dimacs_maker() missing 1 required positional argument: 'mdata' >>> random.seed(2) ->>> engine.gen_using(json_maker, 'testfile', {'min_weight':0, 'max_weight':200, 'vertices':10, 'min_edge':0, 'max_edge':2, 'sign':1, 'direct':1, 'self_loop':1, 'multigraph':0}) +>>> engine.gen_using(json_maker, 'testfile', {'min_weight':0, 'max_weight':200, 'vertices':10, 'min_edge':0, 'max_edge':2, 'sign':True, 'direct':True, 'self_loop':True, 'multigraph':False}) 7 >>> json_to_yaml('testfile') >>> file=open('testfile.yaml','r') @@ -55,7 +54,7 @@ >>> testfile_1_p['properties']['weighted'] True >>> random.seed(4) ->>> engine.gen_using(json_maker, 'testfile2', {'min_weight':0, 'max_weight':50, 'vertices':30, 'min_edge':0, 'max_edge':4, 'sign':1, 'direct':1, 'self_loop':1, 'multigraph':0}) +>>> engine.gen_using(json_maker, 'testfile2', {'min_weight':0, 'max_weight':50, 'vertices':30, 'min_edge':0, 'max_edge':4, 'sign':True, 'direct':True, 'self_loop':True, 'multigraph':False}) 35 >>> json_to_yaml('testfile2') >>> file=open('testfile2.yaml','r') @@ -97,7 +96,7 @@ >>> testfile_2_p['properties']['weighted'] True >>> random.seed(20) ->>> engine.gen_using(json_maker, 'testfile3', {'min_weight':10, 'max_weight':30, 'vertices':100, 'min_edge':0, 'max_edge':4, 'sign':0, 'direct':1, 'self_loop':1, 'multigraph':0}) +>>> engine.gen_using(json_maker, 'testfile3', {'min_weight':10, 'max_weight':30, 'vertices':100, 'min_edge':0, 'max_edge':4, 'sign':False, 'direct':True, 'self_loop':True, 'multigraph':False}) 137 >>> json_to_yaml('testfile3') >>> file=open('testfile3.yaml','r') @@ -166,87 +165,13 @@ Traceback (most recent call last): ... TypeError: wel_maker() missing 1 required positional argument: 'mdata' ->>> random.seed(2) ->>> pyrgg_gen_using(gexf_maker, file_name='testfile', min_weight=0, max_weight=200, vertices_number=10, min_edge=0, max_edge=2, sign=True, direct=True, self_loop=True, multigraph=False) -7 ->>> gexf1 = read_gexf("testfile.gexf") ->>> type(gexf1) - ->>> random.seed(8) ->>> pyrgg_gen_using(gexf_maker, file_name='testfile2', min_weight=0, max_weight=50, vertices_number=30, min_edge=0, max_edge=4, sign=True, direct=True, self_loop=True, multigraph=True) -35 ->>> gexf2 = read_gexf("testfile2.gexf") ->>> type(gexf2) - ->>> random.seed(20) ->>> pyrgg_gen_using(gexf_maker, file_name='testfile3', min_weight=0, max_weight=50, vertices_number=30, min_edge=0, max_edge=4, sign=True, direct=False, self_loop=True, multigraph=True) -35 ->>> gexf3 = read_gexf("testfile3.gexf") ->>> type(gexf3) - ->>> random.seed(120) ->>> pyrgg_gen_using(gexf_maker, file_name='testfile4', min_weight=0, max_weight=50, vertices_number=30, min_edge=0, max_edge=4, sign=True, direct=False, self_loop=True, multigraph=False) -35 ->>> gexf4 = read_gexf("testfile4.gexf") ->>> type(gexf4) - ->>> random.seed(120) ->>> pyrgg_gen_using(gexf_maker, file_name='testfile5', min_weight=0, max_weight=50.2, vertices_number=30, min_edge=0, max_edge=4, sign=True, direct=False, self_loop=True, multigraph=False) -40 ->>> gexf5 = read_gexf("testfile5.gexf") ->>> type(gexf5) - ->>> os.remove('testfile.csv') ->>> os.remove('testfile.gml') ->>> os.remove('testfile.gexf') ->>> os.remove('testfile2.gexf') ->>> os.remove('testfile3.gexf') ->>> os.remove('testfile4.gexf') ->>> os.remove('testfile5.gexf') ->>> os.remove('testfile.gdf') ->>> os.remove('testfile.tsv') ->>> os.remove('testfile.mtx') ->>> os.remove('testfile.dl') ->>> os.remove('testfile.gl') ->>> os.remove('testfile.gr') >>> os.remove('testfile.json') ->>> os.remove('testfile.lp') >>> os.remove('testfile.p') ->>> os.remove('testfile.tgf') ->>> os.remove('testfile.wel') >>> os.remove('testfile.yaml') ->>> os.remove('testfile2.csv') ->>> os.remove('testfile2.gml') ->>> os.remove('testfile2.gdf') ->>> os.remove('testfile2.mtx') ->>> os.remove('testfile2.tsv') ->>> os.remove('testfile2.dl') ->>> os.remove('testfile2.gl') ->>> os.remove('testfile2.gr') >>> os.remove('testfile2.json') ->>> os.remove('testfile2.lp') >>> os.remove('testfile2.p') ->>> os.remove('testfile2.tgf') ->>> os.remove('testfile2.wel') >>> os.remove('testfile2.yaml') ->>> os.remove('testfile3.csv') ->>> os.remove('testfile4.csv') ->>> os.remove('testfile3.gml') ->>> os.remove('testfile3.gdf') ->>> os.remove('testfile3.mtx') ->>> os.remove('testfile3.tsv') ->>> os.remove('testfile3.gl') ->>> os.remove('testfile3.gr') ->>> os.remove('testfile4.gr') ->>> os.remove('testfile4.gml') >>> os.remove('testfile3.json') >>> os.remove('testfile3.p') ->>> os.remove('testfile3.wel') >>> os.remove('testfile3.yaml') ->>> os.remove('testfile.gv') ->>> os.remove('testfile2.gv') ->>> os.remove('testfile3.gv') ->>> os.remove('testfile4.gv') ->>> os.remove('logfile.log') - """