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