File size: 680 Bytes
cd964f2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import unittest
import os
from src.extractor import PassportExtractor

class TestPassportExtractor(unittest.TestCase):
    def test_initialization(self):
        """Test if the extractor can be initialized."""
        try:
            extractor = PassportExtractor(use_gpu=False)
            self.assertIsNotNone(extractor.reader)
        except Exception as e:
            self.fail(f"Initialization failed: {e}")

    def test_utils_import(self):
        """Test if utils can be imported correctly."""
        from src.utils import clean_string
        self.assertEqual(clean_string("Hello 123!"), "HELLO123")

if __name__ == '__main__':
    unittest.main()