MCPcopy Create free account
hub / github.com/JSBSim-Team/jsbsim / InsertAndCompare

Method InsertAndCompare

tests/TestModelLoading.py:91–115  ·  view source on GitHub ↗
(self, section_element, tree)

Source from the content-addressed store, hash-verified

89 self.Compare(section)
90
91 def InsertAndCompare(self, section_element, tree):
92 file_name = append_xml(section_element.attrib['file'])
93 section_file = os.path.join(self.path_to_jsbsim_aircrafts, file_name)
94
95 # If <section> is actually <system>, we need to iterate over all the
96 # directories in which the file is allowed to be stored until the file
97 # is located.
98 if not os.path.exists(section_file) and section_element.tag == 'system':
99 section_file = os.path.join(self.path_to_jsbsim_aircrafts,
100 "systems", file_name)
101 if not os.path.exists(section_file):
102 section_file = self.sandbox.path_to_jsbsim_file("systems",
103 file_name)
104
105 # The original <section> tag is dropped and replaced by the content of
106 # the file.
107 section_root = et.parse(section_file).getroot()
108
109 del section_element.attrib['file']
110 section_element.attrib.update(section_root.attrib)
111 section_element.extend(section_root)
112
113 tree.write(os.path.join(self.aircraft_path, self.aircraft_name+'.xml'))
114
115 self.Compare(section_element.tag+" file:"+section_file)
116
117 def Compare(self, section):
118 # Rerun the script with the modified aircraft definition

Callers 1

ProcessAndCompareMethod · 0.95

Calls 6

CompareMethod · 0.95
append_xmlFunction · 0.90
joinMethod · 0.80
existsMethod · 0.45
path_to_jsbsim_fileMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected