import sys
sys.path.insert(0,".")
import smart_extractor as se
# pitch ~ 700.  Banner spans cols 1-2 (x 0..1500). Article band y 0..2000.
R=[
 {"id":1,"type":"doc_title","bbox":[0,0,1500,150],"confidence":0.9},      # banner (cols1-2)
 {"id":2,"type":"text","bbox":[0,200,700,2000],"confidence":0.9},          # col1 body (has dateline)
 {"id":3,"type":"text","bbox":[760,200,1460,2000],"confidence":0.9},       # col2 body
 {"id":4,"type":"text","bbox":[1520,200,2220,2000],"confidence":0.9},      # col3 CONTINUATION (no dateline)
 {"id":5,"type":"paragraph_title","bbox":[1520,200,2120,260],"confidence":0.9}, # col3 subhead
]
# dateline only in col1 body (region 2)
ds=[{"region_id":2,"bbox":[0,200,700,260],"headline_region":1}]
bl=se.cluster_all_article_blocks(R,dateline_starts=ds,sep_lines=[])
for b in bl:
    print(b["kind"],"anchor",b["anchor_id"],"members",sorted(b["members"]),"bbox",b["bbox"])
assert any(b["anchor_id"]==1 and 4 in b["members"] and 5 in b["members"] for b in bl), "col3 NOT absorbed"
print("\nPASS: col3 (regions 4,5) absorbed into banner block anchor=1")
