def _check_tips(cursor):
 conflicting_tips = cursor.one('\n        SELECT count(*)\n          FROM\n             (\n                SELECT * FROM tips\n                EXCEPT\n                SELECT DISTINCT ON(tipper, tippee, mtime) *\n                  FROM tips\n              ORDER BY tipper, tippee, mtime\n              ) AS foo\n    ')
 assert (conflicting_tips == 0)

def _check_tips ( cursor ) : conflicting_tips = cursor . one ( '\n        SELECT count(*)\n          FROM\n             (\n                SELECT * FROM tips\n                EXCEPT\n                SELECT DISTINCT ON(tipper, tippee, mtime) *\n                  FROM tips\n              ORDER BY tipper, tippee, mtime\n              ) AS foo\n    ' ) assert ( conflicting_tips == 0 )
checks that there are no rows in tips with duplicate .