Esempio n. 1
0
    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
Esempio n. 2
0
 def test_empty_files_does_not_parse(self):
     with pytest.raises(pyhocr.classes.HOCRParseError):
         pyhocr.parse(path.join(BASE_DIR, 'empty_example.html'))
Esempio n. 3
0
def example():
    filename = 'example.html'
    return pyhocr.parse(path.join(BASE_DIR, filename))
Esempio n. 4
0
 def test_empty_strings_does_not_parse(self):
     with pytest.raises(pyhocr.classes.HOCRParseError):
         pyhocr.parse('')
Esempio n. 5
0
 def test_parses_from_string(self):
     assert pyhocr.parse('<html></html>')
Esempio n. 6
0
def example():
    with open(path.join(BASE_DIR, 'example.html')) as f:
        return pyhocr.parse(f.read())