Skip to content

Commit cd0ce01

Browse files
authored
test_segment.py: use stable API
1 parent 340f513 commit cd0ce01

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

tests/test_segment.py

+13-10
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from tests.base import TestCase, assets, main
77

8-
from ocrd import Resolver
8+
from ocrd import Resolver, run_processor
99
from ocrd_utils import initLogging, pushd_popd
1010
from ocrd_kraken.segment import KrakenSegment
1111

@@ -18,42 +18,45 @@ def test_run_blla(self):
1818
resolver = Resolver()
1919
with pushd_popd(tempdir=True) as tempdir:
2020
workspace = resolver.workspace_from_url(assets.path_to('communist_manifesto/data/mets.xml'), dst_dir=tempdir, download=True)
21-
proc = KrakenSegment(
22-
workspace,
21+
run_processor(
22+
KrakenSegment,
23+
workspace=workspace,
2324
input_file_grp="OCR-D-IMG-BIN",
2425
output_file_grp="OCR-D-SEG-LINE-KRAKEN",
2526
parameter={'maxcolseps': 0, 'use_legacy': False}
2627
)
27-
proc.process()
2828
workspace.save_mets()
29+
# FIXME: add result assertions (find_files, parsing PAGE etc)
2930

3031
def test_run_blla_regionlevel(self):
3132
resolver = Resolver()
3233
with pushd_popd(tempdir=True) as tempdir:
3334
workspace = resolver.workspace_from_url(assets.path_to('kant_aufklaerung_1784-page-region/data/mets.xml'), dst_dir=tempdir, download=True)
34-
proc = KrakenSegment(
35-
workspace,
35+
run_processor(
36+
KrakenSegment,
37+
workspace=workspace,
3638
input_file_grp="OCR-D-GT-SEG-REGION",
3739
output_file_grp="OCR-D-SEG-LINE-KRAKEN",
3840
page_id="phys_0005",
3941
parameter={'maxcolseps': 0, 'use_legacy': False}
4042
)
41-
proc.process()
4243
workspace.save_mets()
44+
# FIXME: add result assertions (find_files, parsing PAGE etc)
4345

4446
def test_run_legacy(self):
4547
resolver = Resolver()
4648
# with pushd_popd('/tmp/kraken-test') as tempdir:
4749
with pushd_popd(tempdir=True) as tempdir:
4850
workspace = resolver.workspace_from_url(assets.path_to('communist_manifesto/data/mets.xml'), dst_dir=tempdir, download=True)
49-
proc = KrakenSegment(
50-
workspace,
51+
run_processor(
52+
KrakenSegment,
53+
workspace=workspace,
5154
input_file_grp="OCR-D-IMG-BIN",
5255
output_file_grp="OCR-D-SEG-LINE-KRAKEN",
5356
parameter={'maxcolseps': 0, 'use_legacy': True}
5457
)
55-
proc.process()
5658
workspace.save_mets()
59+
# FIXME: add result assertions (find_files, parsing PAGE etc)
5760

5861
if __name__ == "__main__":
5962
main(__file__)

0 commit comments

Comments
 (0)