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