def __init__(self, json_obj): self.mats = matxl.readMaterials(json_obj["materials"]) self.facs = facxl.readFacs(json_obj["facilities"]) self.fc = fcxl.JsonFuelCycleParser(json_obj["fuelCycle"]).parse() self.commod_nodes, self.market_nodes = self.getResourceNodes() self.sources = self.constructSources() for source in self.sources: self.facs.append(source) self.inst = self.constructInstNode() self.region = self.constructRegionNode()
def test_fac_translation(): json_data = open("input/test_fac.json") data = json.load(json_data) # note that data["recipes"] is an artifact required to print out the xml # nodes that will be fleshed out in higher-level objects facs = readFacs(data["facilities"]) tree = etree.parse("input/test_fac.xml") root = etree.Element("root") for fac in facs: root.append(fac.node) assert_true(compare_nodes(root, tree.getroot(), log = False))