def extractInputBlocks(filename, blocks): """Read input file block(s)""" hit = pyhit.load(filename) out = [] for block in blocks.split(): node = moosetree.find(hit, lambda n: n.fullpath.endswith(block.strip('/'))) if node is None: msg = "Unable to find block '{}' in {}." raise exceptions.MooseDocsException(msg, block, filename) out.append(str(node.render())) return pyhit.parse('\n'.join(out)) if out else hit
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 = pyhit.parse(output) errors = list(Parser.checkDuplicates(root)) self.assertEqual(errors, []) return root