import sqlite3
# Local SQLite fixture. Production PostgreSQL must be tested separately.
c=sqlite3.connect(':memory:')
c.execute('CREATE TABLE invoices(tenant TEXT NOT NULL, ref TEXT NOT NULL, UNIQUE(tenant,ref))')
c.executemany('INSERT INTO invoices VALUES(?,?)',[('A','100'),('B','100')])
for bad in [('A','100'),(None,'200')]:
    try:c.execute('INSERT INTO invoices VALUES(?,?)',bad)
    except sqlite3.IntegrityError:pass
    else:raise AssertionError('invalid identity accepted')
assert c.execute('SELECT COUNT(*) FROM invoices').fetchone()[0]==2
print('PASS: composite uniqueness and NOT NULL in SQLite fixture; no PostgreSQL concurrency test')
