def test_create_note1(self): # With an odf_element note_body = Paragraph('a footnote', style='Standard') note = Note(note_id='note1', citation='1', body=note_body) expected = self.expected.replace( '<text:p>', '<text:p text:style-name="Standard">') self.assertEqual(note.serialize(), expected)
def test_create_note1(self): # With an odf_element note_body = Paragraph("a footnote", style="Standard") note = Note(note_id="note1", citation="1", body=note_body) expected = self.expected.replace( "<text:p>", '<text:p text:style-name="Standard">' ) self.assertEqual(note.serialize(), expected)
def test_insert_note(self): note = Note(note_id='note1', citation="1", body="élément pertubateur") paragraph = Paragraph("Un paragraphe") paragraph.insert_note(note, after="para") expected = ('<text:p>Un para' '<text:note text:note-class="footnote" ' 'text:id="note1">' '<text:note-citation>1</text:note-citation>' '<text:note-body>' '<text:p>élément pertubateur</text:p>' '</text:note-body>' '</text:note>' 'graphe</text:p>') self.assertEqual(paragraph.serialize(), expected)
def test_insert_note_after_span(self): note = Note(note_id='note1', citation="1", body="élément pertubateur") data = "<text:p>Un <text:span>para</text:span>graphe.</text:p>" paragraph = Element.from_tag(data) paragraph.insert_note(note, after="graphe") expected = ('<text:p>Un <text:span>para</text:span>graphe' '<text:note text:note-class="footnote" ' 'text:id="note1">' '<text:note-citation>1</text:note-citation>' '<text:note-body>' '<text:p>élément pertubateur</text:p>' '</text:note-body>' '</text:note>' '.</text:p>') self.assertEqual(paragraph.serialize(), expected)
def test_create_note2(self): # With an unicode object note = Note(note_id="note1", citation="1", body="a footnote") self.assertEqual(note.serialize(), self.expected)
def test_create_note2(self): # With an unicode object note = Note(note_id='note1', citation='1', body='a footnote') self.assertEqual(note.serialize(), self.expected)