Writing mock test for a function which extracrts text from a pdf file

Viewed 24

I have this fuction it reads a pdf file and then extract the text from it. I want to write a unit test for this function. I already tried doing it with mock, but it is showing errors. How can I write a unit test for this function.

def readfile(file):
    reader = PdfReader(file)
    page = reader.pages[0]
    return page.extract_text()
0 Answers
Related