本文整理汇总了Python中pymei.MeiElement.value方法的典型用法代码示例。如果您正苦于以下问题:Python MeiElement.value方法的具体用法?Python MeiElement.value怎么用?Python MeiElement.value使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pymei.MeiElement
的用法示例。
在下文中一共展示了MeiElement.value方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_exportcomment
# 需要导入模块: from pymei import MeiElement [as 别名]
# 或者: from pymei.MeiElement import value [as 别名]
def test_exportcomment(self):
doc = MeiDocument()
root = MeiElement("mei")
root.id = "myid"
doc.root = root
comment = MeiElement("_comment")
comment.value = "comment"
comment.tail = "t"
root.addChild(comment)
expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<mei xml:id=\"myid\" xmlns=\"http://www.music-encoding.org/ns/mei\" meiversion=\"2013\">\n\t<!--comment-->t</mei>\n"
ret = documentToText(doc)
self.assertEqual(expected, ret)
示例2: test_exportvalueandtail
# 需要导入模块: from pymei import MeiElement [as 别名]
# 或者: from pymei.MeiElement import value [as 别名]
def test_exportvalueandtail(self):
doc = MeiDocument()
root = MeiElement("mei")
root.id = "myid"
doc.root = root
note = MeiElement("note")
note.id = "noteid"
note.value = "value"
note.tail = "tail"
root.addChild(note)
expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<mei xml:id=\"myid\" xmlns=\"http://www.music-encoding.org/ns/mei\" meiversion=\"2013\">\n\t<note xml:id=\"noteid\">value</note>tail</mei>\n"
ret = documentToText(doc)
self.assertEqual(expected, ret)
示例3: test_exportnamespace2
# 需要导入模块: from pymei import MeiElement [as 别名]
# 或者: from pymei.MeiElement import value [as 别名]
def test_exportnamespace2(self):
doc = MeiDocument()
root = MeiElement("mei")
root.id = "myid"
doc.root = root
xlink = MeiNamespace("xlink", "http://www.w3.org/1999/xlink")
attr = MeiAttribute(xlink, "title", "my awesome thing")
music = MeiElement("music")
music.id = "musid"
music.addAttribute(attr)
music.value = "mus!"
root.addChild(music)
expected = "<?xml version=\"1.0\"?>\n<mei xmlns=\"http://www.music-encoding.org/ns/mei\" \
xmlns:xlink=\"http://www.w3.org/1999/xlink\" xml:id=\"myid\" meiversion=\"2013\">\n <music \
xml:id=\"musid\" xlink:title=\"my awesome thing\">mus!</music>\n</mei>\n"
ret = XmlExport.meiDocumentToText(doc)
self.assertEqual(expected, ret)
示例4: test_value
# 需要导入模块: from pymei import MeiElement [as 别名]
# 或者: from pymei.MeiElement import value [as 别名]
def test_value(self):
para = MeiElement("p")
para.value = "I am text"
self.assertEqual(para.value, "I am text")