Exemplo n.º 1
0
 def readInputData(self, data, filename):
     try:
         self.filename = os.path.abspath(filename)
         root = hit.parse(os.path.abspath(filename), data)
         hit.explode(root)
         w = DupWalker(os.path.abspath(filename))
         root.walk(w, hit.NodeType.Field)
         if w.errors:
             for err in w.errors:
                 mooseutils.mooseWarning(err)
             raise PeacockException("Parser errors")
         self.original_text = data
         self.root_node = root
         self.changed = False
     except PeacockException as e:
         msg = "Failed to parse input file %s:\n%s\n" % (filename, e)
         mooseutils.mooseWarning(msg)
         raise e
Exemplo n.º 2
0
    def getInputFileFormat(self, extra=[]):
        """
        Does a dump and uses the GetPotParser to parse the output.
        """
        args = ["--disable-refcount-printing", "--dump"] + extra
        output = run_app(args)
        self.assertIn("### START DUMP DATA ###\n", output)
        self.assertIn("### END DUMP DATA ###\n", output)

        output = output.split('### START DUMP DATA ###\n')[1]
        output = output.split('### END DUMP DATA ###')[0]

        self.assertNotEqual(len(output), 0)
        root = hit.parse("dump.i", output)
        hit.explode(root)
        w = DupWalker("dump.i")
        root.walk(w, hit.NodeType.All)
        if w.errors:
            print("\n".join(w.errors))
        self.assertEqual(len(w.errors), 0)
        return root