MCPcopy Create free account
hub / github.com/Topdu/OpenOCR / __init__

Method __init__

test_openocr.py:25–50  ·  view source on GitHub ↗

Initialize tester and download test images

(self)

Source from the content-addressed store, hash-verified

23 """Test suite for OpenOCR functionality"""
24
25 def __init__(self):
26 """Initialize tester and download test images"""
27 logger.info('=' * 80)
28 logger.info('OpenOCR Test Suite')
29 logger.info('=' * 80)
30
31 # Download test images
32 logger.info('\n📥 Downloading test images...')
33 self.image_paths = download_example_images()
34
35 # Verify image paths
36 self.ocr_images = Path(self.image_paths.get('ocr', ''))
37 self.rec_images = Path(self.image_paths.get('unirec', '')) / '..' / 'rec' # Use rec folder
38 self.doc_images = Path(self.image_paths.get('doc', ''))
39 self.unirec_images = Path(self.image_paths.get('unirec', ''))
40
41 # Create output directory
42 self.output_dir = Path('test_output')
43 self.output_dir.mkdir(exist_ok=True)
44
45 logger.info('\n📁 Test image directories:')
46 logger.info(f' OCR/Det: {self.ocr_images}')
47 logger.info(f' Rec: {self.rec_images}')
48 logger.info(f' Doc: {self.doc_images}')
49 logger.info(f' UniRec: {self.unirec_images}')
50 logger.info(f' Output: {self.output_dir}')
51
52 def get_test_image(self, image_dir):
53 """Get first valid image from directory"""

Callers

nothing calls this directly

Calls 2

download_example_imagesFunction · 0.90
getMethod · 0.80

Tested by

no test coverage detected