#!/usr/bin/env python3
"""Writes the test inputs into ./in: titles.txt, sheet.csv (with a UTF-8 BOM, as Excel saves it) and four description files."""
import csv, os
os.makedirs('in', exist_ok=True)
base = 'Slow Zoom Tutorial '
t = ['How to Edit Video on a Phone: 5 Free Steps',
     (base + 'x' * 100)[:101],
     (base + 'x' * 100)[:100],
     'M' * 80 + '\U0001F600' * 15,
     'Why <b> tags break a title'.replace('a title', 'a title'),
     'वीडियो एडिटिंग सीखें']
t[4] = 'Why <b> tags break a title'
open('in/titles.txt', 'w', encoding='utf-8').write('\n'.join(t) + '\n')
open('in/desc_ok.txt', 'w').write(('Step by step phone editing. ' * 43)[:1200])
open('in/desc_cyr.txt', 'w', encoding='utf-8').write('д' * 3000)
open('in/desc_5000.txt', 'w').write('a' * 5000)
open('in/desc_5001.txt', 'w').write('a' * 5001)
with open('in/sheet.csv', 'w', encoding='utf-8-sig', newline='') as f:
    w = csv.writer(f)
    w.writerow(['Title', 'Description'])
    w.writerow([t[0], 'Line one\nLine two, with a comma'])
    w.writerow([t[1], 'x'])
    w.writerow(['Short title, with comma', 'y'])
    w.writerow([t[3], 'z'])
