From 5093d72b9fece1a7c3d7a3d19e4161387ee6475a Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Fri, 25 Nov 2022 22:50:05 +0000 Subject: Use pytest instead of nose --- tests/docx/document_xml_tests.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'tests/docx/document_xml_tests.py') diff --git a/tests/docx/document_xml_tests.py b/tests/docx/document_xml_tests.py index fa63775..e93392c 100644 --- a/tests/docx/document_xml_tests.py +++ b/tests/docx/document_xml_tests.py @@ -1,33 +1,29 @@ -from nose.tools import istest, assert_equal - from mammoth import documents from mammoth.docx.xmlparser import element as xml_element, text as xml_text from mammoth.docx.document_xml import read_document_xml_element from mammoth.docx import body_xml +from ..testing import assert_equal -@istest class ReadXmlElementTests(object): - @istest - def can_read_text_within_document(self): + def test_can_read_text_within_document(self): element = _document_element_with_text("Hello!") assert_equal( documents.document([documents.paragraph([documents.run([documents.Text("Hello!")])])]), _read_and_get_document_xml_element(element) ) - - @istest - def footnotes_of_document_are_read(self): + + def test_footnotes_of_document_are_read(self): notes = [documents.note("footnote", "4", [documents.paragraph([])])] - + body_xml = xml_element("w:body") document_xml = xml_element("w:document", {}, [body_xml]) - + document = _read_and_get_document_xml_element(document_xml, notes=notes) footnote = document.notes.find_note("footnote", "4") assert_equal("4", footnote.note_id) assert isinstance(footnote.body[0], documents.Paragraph) - + def _read_and_get_document_xml_element(*args, **kwargs): body_reader = body_xml.reader() -- cgit v1.2.3