Example #1
0
    def test_readGraph_dot_path2(self):

        if "dot" not in supported_formats()["simple"]:
            self.skipTest("No support for Dot file I/O.")

        self.assertRaises(ValueError, readGraph, sio(dot_path2), graph_type="simple")
        G = readGraph(sio(dot_path2), graph_type="simple", file_format="dot")
        self.assertEqual(G.order(), 3)
        self.assertEqual(len(G.edges()), 2)
Example #2
0
    def test_readGraph_dot_path2(self):

        if 'dot' not in supported_formats()['simple']:
            self.skipTest("No support for Dot file I/O.")

        self.assertRaises(ValueError, readGraph, sio(
            dot_path2), graph_type='simple')
        G = readGraph(sio(dot_path2), graph_type='simple', file_format='dot')
        self.assertEqual(G.order(), 3)
        self.assertEqual(len(G.edges()), 2)
Example #3
0
    def test_readGraph_dot_path2_file(self):

        if "dot" not in supported_formats()["simple"]:
            self.skipTest("No support for Dot file I/O.")

        with open(example_filename("path2.dot"), "r") as ifile:

            # Parsing should fail here
            self.assertRaises(ValueError, readGraph, ifile, graph_type="simple", file_format="gml")

            ifile.seek(0)

            # Parser should guess that it is a dot file
            G = readGraph(ifile, graph_type="simple")
            self.assertEqual(G.order(), 3)
            self.assertEqual(len(G.edges()), 2)
Example #4
0
    def test_readGraph_dot_path2_file(self) :

        if 'dot' not in supported_formats()['simple']:
            self.skipTest("No support for Dot file I/O.")
        
        with open(example_filename('path2.dot'),'r') as ifile:

            # Parsing should fail here
            self.assertRaises(ValueError, readGraph, ifile, graph_type='simple', file_format='gml')

            ifile.seek(0)
            
            # Parser should guess that it is a dot file
            G = readGraph(ifile, graph_type='simple')
            self.assertEqual(G.order(), 3)
            self.assertEqual(len(G.edges()), 2)
Example #5
0
    def test_readGraph_dot_path2_file(self):

        if 'dot' not in supported_formats()['simple']:
            self.skipTest("No support for Dot file I/O.")

        with open(example_filename('path2.dot'), 'r') as ifile:

            # Parsing should fail here
            self.assertRaises(ValueError, readGraph, ifile,
                              graph_type='simple', file_format='gml')

            ifile.seek(0)

            # Parser should guess that it is a dot file
            G = readGraph(ifile, graph_type='simple')
            self.assertEqual(G.order(), 3)
            self.assertEqual(len(G.edges()), 2)