File size: 1,160 Bytes
6def286
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import sys
import os
import cv2

# Add project root to sys.path
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

from cin_validator import CINValidator

print("Instantiating CINValidator...")
validator = CINValidator()

# Use assets/ref_flag.jpg for testing
assets_dir = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "assets")
image_path = os.path.join(assets_dir, "ref_flag.jpg")

if os.path.exists(image_path):
    print(f"\nLoading local test image: {image_path}")
    img = cv2.imread(image_path)
    
    # Mock download_image to return our local image
    validator.download_image = lambda url: img
    
    # Test Recto
    print("\n--- Testing Recto Validation ---")
    res_recto = validator.validate("dummy_url", "recto")
    print("Recto Result:")
    for k, v in res_recto.items():
        print(f"  {k}: {v}")
        
    # Test Verso
    print("\n--- Testing Verso Validation ---")
    res_verso = validator.validate("dummy_url", "verso")
    print("Verso Result:")
    for k, v in res_verso.items():
        print(f"  {k}: {v}")
else:
    print(f"Test image not found at: {image_path}")