38 lines
1.1 KiB
Python
Executable File
38 lines
1.1 KiB
Python
Executable File
import csv
|
|
import sys
|
|
|
|
PATH = '/root/troupe-standup/wizard-work/ledger/wizards.csv'
|
|
|
|
|
|
def main():
|
|
with open(PATH, newline='', encoding='utf-8') as f:
|
|
rows = list(csv.reader(f))
|
|
|
|
errors = []
|
|
if not rows:
|
|
errors.append('empty file')
|
|
else:
|
|
if rows[0] != ['Wizard', 'Model', 'Lane', 'Latest check-in', 'Current unit']:
|
|
errors.append('bad header: %r' % rows[0])
|
|
data = rows[1:]
|
|
if len(data) != 10:
|
|
errors.append('expected 10 data rows, got %d' % len(data))
|
|
names = [r[0] for r in data]
|
|
for need in ('Zephyrus Sparkborn', 'Merlin'):
|
|
if need not in names:
|
|
errors.append('%s missing' % need)
|
|
models = [r[1] for r in data]
|
|
if 'StepFun Step 5' not in models:
|
|
errors.append('Merlin model != StepFun Step 5: %r' % models)
|
|
if errors:
|
|
print('FAIL:')
|
|
for e in errors:
|
|
print(' -', e)
|
|
sys.exit(1)
|
|
print('OK: wizards.csv -> header + 10 data rows (10 wizards)')
|
|
sys.exit(0)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|