class TestGraphParser(unittest.TestCase):
    """
    This class contains the test methods of the class GraphParser.

    """

    def setUp(self):
        self.gparser = GraphParser()

    def test_parse(self):
        """Raise an assertion if can't find a file.

        Return a PyGraph.

        Raises
        ------
        AssertionError
            If the can't find the file.

        """

        # Change directory
        # Opening the expected file result

        filename = os.path.dirname(__file__) + '/sample_files/balochi-graid1.xml'
        g = self.gparser.parse(filename)

        expected_result = 651
        assert(len(g.nodes) == expected_result)

        filename = os.path.dirname(__file__) + '/sample_files/balochi.hdr'
        g = self.gparser.parse(filename)

        expected_result = 1161
        assert(len(g.nodes) == expected_result)

        # Check the parsed dependencies
        expected_parsed_deps = set(['word', 'clause_unit', 'utterance'])

        parsed_dependencies = self.gparser._parsed_deps

        assert(parsed_dependencies == expected_parsed_deps)
Exemple #2
0
class TestGraphParser:
    """
    This class contains the test methods of the class GraphParser.

    """

    def setUp(self):
        self.gparser = GraphParser()

    def test_parse(self):
        """Raise an assertion if can't find a file.

        Return a PyGraph.

        Raises
        ------
        AssertionError
            If the can't find the file.

        """

        # Change directory
        # Opening the expected file result

        filename = os.path.dirname(__file__) + '/sample_files/balochi-graid1.xml'
        g = self.gparser.parse(filename)

        expected_result = 651
        assert(len(g.nodes) == expected_result)

        filename = os.path.dirname(__file__) + '/sample_files/balochi.hdr'
        g = self.gparser.parse(filename)

        expected_result = 1161
        assert(len(g.nodes) == expected_result)

        # Check the parsed dependencies
        expected_parsed_deps = set(['word', 'clause_unit', 'utterance'])

        parsed_dependencies = self.gparser._parsed_deps

        assert(parsed_dependencies == expected_parsed_deps)
 def setUp(self):
     self.gparser = GraphParser()
Exemple #4
0
 def setUp(self):
     self.gparser = GraphParser()