当前位置: 首页>>代码示例>>Python>>正文


Python documentFields.DocumentFields类代码示例

本文整理汇总了Python中document.documentFields.DocumentFields的典型用法代码示例。如果您正苦于以下问题:Python DocumentFields类的具体用法?Python DocumentFields怎么用?Python DocumentFields使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了DocumentFields类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: internFolders

    def internFolders(self):
        a = DocumentFields()
        a.setField("title", "document")

        d = DocumentFolder()
        d.setDocFields(a)
        d.create()

        assert(d.getDir().exists())

        assert(not d.hasVideoFolder())
        assert(not d.hasImageFolder())
        assert(not d.hasNotesFolder())
        assert(not d.hasDescFolder())

        d.createVideoFolder()
        d.createImageFolder()
        d.createNotesFolder()
        d.createDescFolder()

        assert(d.hasVideoFolder())
        assert(d.hasImageFolder())
        assert(d.hasNotesFolder())
        assert(d.hasDescFolder())

        d.delete()
开发者ID:starfox644,项目名称:bibmngr2015py,代码行数:26,代码来源:test_documentFolder.py

示例2: test_organizeWithFiles

    def test_organizeWithFiles(self):
        fields = DocumentFields()
        fields.setField("title", "document about internet")
        d = DocumentFolder()
        d.setDocFields(fields)

        bibfile = File("bibfile.bib")
        bibfile.createFile()
        pdffilename = "pdffile.pdf"
        pdffile = File(pdffilename)
        pdffile.createFile()
        fileList = [bibfile, pdffilename]

        d.create()

        d.organize(fileList)
        self.assertFalse(File("bibfile.bib").exists())
        self.assertFalse(File("pdffile.pdf").exists())

        folderPath = d.getDir().getPath().getAbsolutePath()
        newbibfile = File(folderPath + "/" + "bibfile.bib")
        newpdffile = File(folderPath + "/" + "pdffile.pdf")

        self.assertTrue(newbibfile.exists())
        self.assertTrue(newpdffile.exists())

        d.delete()
开发者ID:starfox644,项目名称:bibmngr2015py,代码行数:27,代码来源:test_documentFolder.py

示例3: titleContent

 def titleContent(self):
     d = DocumentFields()
     d.setField("title", "document about internet")
     notes = Notes(d)
     notes.createTitle()
     content = notes.getDocumentContent()
     expectedContent = "document about internet\n\n"
     # print content
     # print expectedContent
     assert(content == expectedContent)
开发者ID:starfox644,项目名称:bibmngr2015py,代码行数:10,代码来源:test_notes.py

示例4: folderName

    def folderName(self):
        a = DocumentFields()
        a.setField("title", "document")
        
        d = DocumentFolder()
        d.setDocFields(a)

        for i, title in enumerate(self.titles):
            a.setField("title", title)
            name = d.computeFolderName()
            assert(name == self.folderNames[i])
开发者ID:starfox644,项目名称:bibmngr2015py,代码行数:11,代码来源:test_documentFolder.py

示例5: titleContent

 def titleContent(self):
     d = DocumentFields()
     d.setField("title", "document about internet")
     notes = LatexNotes(d)
     notes.createTitle()
     content = notes.getDocumentContent()
     expectedContent = LatexNotes.HEADER
     expectedContent += "\\title{document about internet}\n"
     expectedContent += "\\maketitle\n"
     expectedContent += "\n"
     expectedContent += "\\end{document}\n"
     # print content
     # print expectedContent
     assert(content == expectedContent)
开发者ID:starfox644,项目名称:bibmngr2015py,代码行数:14,代码来源:test_latexNotes.py

示例6: test_changeField

 def test_changeField(self):
     a = DocumentFields()
     a.setField("title", "bc")
     a.setField("title", "Other")
     self.assertEqual (a.getNbFields(), 1)
     self.assertTrue(a.hasField("title"))
     self.assertEqual(a.getField("title"), "Other")
开发者ID:starfox644,项目名称:bibmngr2015py,代码行数:7,代码来源:test_documentFields.py

示例7: descTableYear

 def descTableYear(self):
     d = DocumentFields()
     d.setField("year", "2014")
     notes = Notes(d)
     notes.createDescriptionTable()
     content = notes.getDocumentContent()
     expectedContent = Notes.TABLE_HEADER
     expectedContent += "Annee = 2014\n"
     expectedContent += Notes.TABLE_END
     # contentLines = content.splitlines()
     # expLines = expectedContent.splitlines()
     # d = difflib.Differ()
     # diff = d.compare(contentLines, expLines)
     # print "\n".join(diff)
     assert(content == expectedContent)
开发者ID:starfox644,项目名称:bibmngr2015py,代码行数:15,代码来源:test_notes.py

示例8: descTableAuthors

 def descTableAuthors(self):
     d = DocumentFields()
     d.setField("author", "John Bruf, Tommy Bamo")
     notes = Notes(d)
     notes.createDescriptionTable()
     content = notes.getDocumentContent()
     expectedContent = Notes.TABLE_HEADER
     expectedContent += "Auteurs = John Bruf, Tommy Bamo\n"
     expectedContent += Notes.TABLE_END
     contentLines = content.splitlines()
     expLines = expectedContent.splitlines()
     d = difflib.Differ()
     diff = d.compare(contentLines, expLines)
     # print "\n".join(diff)
     assert(content == expectedContent)
开发者ID:starfox644,项目名称:bibmngr2015py,代码行数:15,代码来源:test_notes.py

示例9: descTableKeywords

 def descTableKeywords(self):
     d = DocumentFields()
     d.setField("keywords", "Computer science, Photography")
     notes = Notes(d)
     notes.createDescriptionTable()
     content = notes.getDocumentContent()
     expectedContent = Notes.TABLE_HEADER
     expectedContent += "Mots-cles = Computer science, Photography\n"
     expectedContent += Notes.TABLE_END
     # contentLines = content.splitlines()
     # expLines = expectedContent.splitlines()
     # d = difflib.Differ()
     # diff = d.compare(contentLines, expLines)
     # print "\n".join(diff)
     assert(content == expectedContent)
开发者ID:starfox644,项目名称:bibmngr2015py,代码行数:15,代码来源:test_notes.py

示例10: descTableJournal

 def descTableJournal(self):
     d = DocumentFields()
     d.setField("journal", "Journal of Computer Science")
     notes = Notes(d)
     notes.createDescriptionTable()
     content = notes.getDocumentContent()
     expectedContent = Notes.TABLE_HEADER
     expectedContent += "Journal = Journal of Computer Science\n"
     expectedContent += Notes.TABLE_END
     # contentLines = content.splitlines()
     # expLines = expectedContent.splitlines()
     # d = difflib.Differ()
     # diff = d.compare(contentLines, expLines)
     # print "\n".join(diff)
     assert(content == expectedContent)
开发者ID:starfox644,项目名称:bibmngr2015py,代码行数:15,代码来源:test_notes.py

示例11: read

    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
        
开发者ID:starfox644,项目名称:bibmngr2015py,代码行数:16,代码来源:bibtexReader.py

示例12: test_create

    def test_create(self):
        a = DocumentFields()
        a.setField("title", "document")

        d = DocumentFolder()
        d.setDocFields(a)

        # Creation in local folder
        for title in self.titles:
            a.setField("title", title)
            d.create()
            self.assertTrue(d.getDir().exists())
            d.delete()
            self.assertFalse(d.getDir().exists())

        dir = Directory("documents")
        dir.createDir()

        # Creaton in another folder
        for title in self.titles:
            a.setField("title", title)
            d.create(dir.getPath().getAbsolutePath())
            self.assertTrue(d.getDir().exists())
            d.delete()
            self.assertFalse(d.getDir().exists())

        dir.removeDir()
开发者ID:starfox644,项目名称:bibmngr2015py,代码行数:27,代码来源:test_documentFolder.py

示例13: create

    def create(self):
        a = DocumentFields()
        a.setField("title", "document")

        d = DocumentFolder()
        d.setDocFields(a)

        for title in self.titles:
            a.setField("title", title)
            d.create()
            assert(d.getDir().exists())
            d.delete()
            assert(not d.getDir().exists())

        dir = Directory("documents")
        dir.createDir()

        for title in self.titles:
            a.setField("title", title)
            d.create(dir.getPath().getAbsolutePath())
            assert(d.getDir().exists())
            d.delete()
            assert(not d.getDir().exists())

        dir.removeDir()
开发者ID:starfox644,项目名称:bibmngr2015py,代码行数:25,代码来源:test_documentFolder.py

示例14: descTableAuthors

    def descTableAuthors(self):
        d = DocumentFields()
        d.setField("author", "Bruf, John and Bamo, Tomy")
        notes = WikiNotes(d)
        notes.createDescriptionTable()
        content = notes.getDocumentContent()

        expectedContent = WikiNotes.TABLE_HEADER
        expectedContent += ( "|Auteurs :\n"
                            "| \'\'\'John Bruf, Tomy Bamo\'\'\'\n"
                            "|-\n")
        expectedContent += WikiNotes.TABLE_END

        contentLines = content.splitlines()
        expLines = expectedContent.splitlines()
        d = difflib.Differ()
        diff = d.compare(contentLines, expLines)
        # print "\n".join(diff)
        assert(content == expectedContent)
开发者ID:starfox644,项目名称:bibmngr2015py,代码行数:19,代码来源:test_wikiNotes.py

示例15: setType

 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)
开发者ID:starfox644,项目名称:bibmngr2015py,代码行数:9,代码来源:test_documentFields.py


注:本文中的document.documentFields.DocumentFields类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。