Exemplo n.º 1
0
 def emptyContent(self):
     d = DocumentFields()
     notes = Notes(d)
     content = notes.getDocumentContent()
     expectedContent = ""
     # print expectedContent
     assert(content == expectedContent)
Exemplo n.º 2
0
    def descAll(self):
        d = DocumentFields()
        d.setField("title", "document about internet")
        d.setField("year", "2014")
        d.setField("author", "John Bruf, Tommy Bamo")
        d.setField("keywords", "Computer science, Photography")
        d.setField("journal", "Journal of Computer Science")
        notes = Notes(d)
        notes.createAllContent()
        content = notes.getDocumentContent()
        expectedContent = "document about internet\n\n"
        expectedContent += Notes.TABLE_HEADER
        expectedContent += "Annee = 2014\n"
        expectedContent += "Auteurs = John Bruf, Tommy Bamo\n"
        expectedContent += "Mots-cles = Computer science, Photography\n"
        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)
Exemplo n.º 3
0
 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)
Exemplo n.º 4
0
 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)
Exemplo n.º 5
0
 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)
Exemplo n.º 6
0
 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)
Exemplo n.º 7
0
 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)