From 197440c938d4c245f5c51d252a0c528b02bad910 Mon Sep 17 00:00:00 2001 From: Chad Whitacre Date: Mon, 28 Mar 2016 08:45:00 -0400 Subject: [PATCH] Better handle mismatch cases --- match-balanced.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/match-balanced.py b/match-balanced.py index 55e5adc8b8..64e0d9d289 100755 --- a/match-balanced.py +++ b/match-balanced.py @@ -120,10 +120,22 @@ def process_month(db, cid2mat, uid2cid, year, month): rec2mat[rec['id']] = match if match.route is not None: - assert match.ref == rec['id'] - assert match.status is not None - ordered.pop() - print('all set!') + if match.ref is None and match.status is None: + print('missing ref and status!') + elif match.ref != rec['id'] and match.status != rec['status']: + print('mismatched ref and status!') + elif match.ref is None: + print('missing ref!') + elif match.ref != rec['id']: + print('mismatched ref!') + elif match.status is None: + print('missing status!') + elif match.status != rec['status']: + print('mismatched status!') + + else: + ordered.pop() + print('all set!') else: print('yes') else: