            start=date.fromisoformat(data['ordered_at']);holidays={date.fromisoformat(x) for x in data['holidays']};rows=[]
            for term in output['terms']:
                current=start;remaining=term['days']
                while remaining:
                    current+=timedelta(days=1)
                    if term['kind']=='calendar' or (current.weekday()<5 and current not in holidays):remaining-=1
                rows.append({**term,'ordered_at':str(start),'expected_date':str(current)})
            check('自然日包含周末',[r['expected_date'] for r in rows if r['supplier']=='A']==['2026-10-11']);check('工作日跳过指定假日与周末',[r['expected_date'] for r in rows if r['supplier']=='B']==['2026-10-14']);check('不把工作日承诺转成自然日',rows[0]['expected_date']!=rows[1]['expected_date']);cout('lead-time-calendar.csv',rows);result={'terms':rows,'holidays':data['holidays']}
