コード例 #1
0
 def emptyContent(self):
     d = DocumentFields()
     notes = WikiNotes(d)
     content = notes.getDocumentContent()
     expectedContent = ""
     # print expectedContent
     assert(content == expectedContent)
コード例 #2
0
 def titleContent(self):
     d = DocumentFields()
     d.setField("title", "document about internet")
     notes = WikiNotes(d)
     notes.createTitle()
     content = notes.getDocumentContent()
     expectedContent = ""
     # print content
     # print expectedContent
     assert(content == expectedContent)
コード例 #3
0
    def descTableKeywords(self):
        d = DocumentFields()
        d.setField("keywords", "Computer science, Photography")
        notes = WikiNotes(d)
        notes.createDescriptionTable()
        content = notes.getDocumentContent()

        expectedContent = WikiNotes.TABLE_HEADER
        expectedContent += ("|Mots-cles :\n"
                            "| \'\'\'Computer science, Photography\'\'\'\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)
コード例 #4
0
    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)
コード例 #5
0
    def descTableYear(self):
        d = DocumentFields()
        d.setField("year", "2014")
        notes = WikiNotes(d)
        notes.createDescriptionTable()
        content = notes.getDocumentContent()

        expectedContent = WikiNotes.TABLE_HEADER
        expectedContent += ("|Annee :\n"
                            "| \'\'\'2014\'\'\'\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)
コード例 #6
0
    def descTableJournal(self):
        d = DocumentFields()
        d.setField("journal", "Journal of Computer Science")
        notes = WikiNotes(d)
        notes.createDescriptionTable()
        content = notes.getDocumentContent()

        expectedContent = WikiNotes.TABLE_HEADER
        expectedContent += ("|Journal :\n"
                            "| \'\'\'Journal of Computer Science\'\'\'\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)
コード例 #7
0
    def descTableAll(self):
        d = DocumentFields()
        d.setField("title", "document about internet")
        d.setField("year", "2014")
        d.setField("author", "Bruf, John and Bamo, Tomy")
        d.setField("keywords", "Computer science, Photography")
        d.setField("journal", "Journal of Computer Science")
        notes = WikiNotes(d)
        notes.createTitle()
        notes.createDescriptionTable()
        content = notes.getDocumentContent()

        expectedContent = WikiNotes.TABLE_HEADER
        expectedContent += ("|Annee :\n"
                            "| \'\'\'2014\'\'\'\n"
                            "|-\n"
                            "|Auteurs :\n"
                            "| \'\'\'John Bruf, Tomy Bamo\'\'\'\n"
                            "|-\n"
                            "|Mots-cles :\n"
                            "| \'\'\'Computer science, Photography\'\'\'\n"
                            "|-\n"
                            "|Journal :\n"
                            "| \'\'\'Journal of Computer Science\'\'\'\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)