#magicmock
#волшебный замок
Вопрос:
во время тестирования одного из моих модулей с помощью модульного теста я столкнулся с приведенной ниже ошибкой утверждения Magic Moc, пожалуйста, помогите устранить эту ошибку. Я только смотрю, пройдет ли данный тестовый случай. Ниже мой код и ошибка.
import sys # from unittest.mock import MagicMock from unittest import mock from src.job_spec_extraction import JobSpecDocument from src.cv_extraction import CVDocument from src.document_extraction import Document from src.nlp_models.cv_sections_model import CvSectionsModel class TestJobSpec_section(unittest.TestCase): def test_extract_docx(self): x = CVDocument() sections = x.extract_docx("tests/test_data/test_uploads/Job_desc.docx") assert 'The successful candidate will join' in sections['description'] assert 'C , Python, and R' in sections ['responsibilities'] and the error when run this code is def test_extract_docx(self): x = CVDocument() sections = x.extract_docx("tests/test_data/test_uploads/Job_desc.docx") gt; assert 'The successful candidate will join' in sections['description'] E AssertionError: assert 'The successful candidate will join' in lt;MagicMock name='mock.CVDocument().extract_docx().__getitem__()' id='140297353569672'gt;