def setUp(self): self.variants = [mme.Hook, # I removed richcontent variants because # they do not work correctly when their html is not set. it causes ET to crash mme.EmbeddedImage, mme.MapConfig, mme.Equation, mme.AutomaticEdgeColor] self.mm = MindMap() root = self.mm[0] root[:] = [] # clear out children of root for variant in self.variants: root.append(variant()) # add a child variant element type self.filename = uuid4().hex + '.mm' self.mm.write(self.filename) # need to remember to erase file later... self.mm2 = pymm.read(self.filename)
def test_read_and_write_file(self): """Test the reading and writing of a mind map. Also (important) verify that order and number of factories used is same (or nearly so) """ # Since this test could be run outside of it's directory, derive the # path to the doc file in a more portable way. this_path = os.path.dirname(os.path.realpath(__file__)) mm_path = os.path.join(this_path, '../docs/input.mm') mind_map = pymm.read(mm_path) self.assertTrue(mind_map) self.assertTrue(mind_map.root) pymm.write(self.filename, mind_map) self.verify_conversion_traces_match()
def setUp(self): """create variant children. Must be in order from least specific to most specific. Hook must come before an element that inherits from Hook, for example """ self.variants = [ mme.Hook, mme.RichContent, mme.NodeNote, mme.Equation, mme.EmbeddedImage, mme.MapConfig, mme.NodeDetails, mme.AutomaticEdgeColor ] self.mind_map = Mindmap() root = self.mind_map.root # clear out children of root root.children = [] for variant in self.variants: # add a child variant element type root.children.append(variant()) self.filename = uuid4().hex + '.mm' pymm.write(self.filename, self.mind_map) self.second_mind_map = pymm.read(self.filename)
def test_read_file(self): mm = pymm.read('../docs/input.mm') self.assertTrue(mm) self.assertTrue(mm.getroot()) mm.write('input_2.mm')