本文整理汇总了Python中document.documentFields.DocumentFields.setDocType方法的典型用法代码示例。如果您正苦于以下问题:Python DocumentFields.setDocType方法的具体用法?Python DocumentFields.setDocType怎么用?Python DocumentFields.setDocType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类document.documentFields.DocumentFields
的用法示例。
在下文中一共展示了DocumentFields.setDocType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_setType
# 需要导入模块: from document.documentFields import DocumentFields [as 别名]
# 或者: from document.documentFields.DocumentFields import setDocType [as 别名]
def test_setType(self):
a = DocumentFields()
for t in DocumentFields.TYPES:
a.setDocType(t)
self.assertEqual(a.getDocType(), t)
a.setDocType(DocumentFields.DOC_UNKNOWN)
self.assertEqual(a.getDocType(), DocumentFields.DOC_UNKNOWN)
示例2: setType
# 需要导入模块: from document.documentFields import DocumentFields [as 别名]
# 或者: from document.documentFields.DocumentFields import setDocType [as 别名]
def setType(self):
a = DocumentFields()
for t in DocumentFields.TYPES:
a.setDocType(t)
assert (a.getDocType() == t)
a.setDocType(DocumentFields.OTHER)
assert (a.getDocType() == DocumentFields.OTHER)
示例3: read
# 需要导入模块: from document.documentFields import DocumentFields [as 别名]
# 或者: from document.documentFields.DocumentFields import setDocType [as 别名]
def read(self):
fields = DocumentFields()
with open(self.path.path) as bibtex_file:
bibtex_str = bibtex_file.read()
bib_database = bibtexparser.loads(bibtex_str)
for entry in bib_database.entries:
for field, value in entry.items():
if (field == "ENTRYTYPE"):
docType = strToDocType(value)
fields.setDocType(docType)
elif (field != "ID"):
fields.setField(field, value)
return fields