def test_parse_from_stream(self, example): with open(path.join(BASE_DIR, 'example.html'), 'rb') as stream: hocr = pyhocr.parse(stream) assert hocr == example
def test_empty_files_does_not_parse(self): with pytest.raises(pyhocr.classes.HOCRParseError): pyhocr.parse(path.join(BASE_DIR, 'empty_example.html'))
def example(): filename = 'example.html' return pyhocr.parse(path.join(BASE_DIR, filename))
def test_empty_strings_does_not_parse(self): with pytest.raises(pyhocr.classes.HOCRParseError): pyhocr.parse('')
def test_parses_from_string(self): assert pyhocr.parse('<html></html>')
def example(): with open(path.join(BASE_DIR, 'example.html')) as f: return pyhocr.parse(f.read())