From fb9d0c85c7a1a4bd795a58f167172a1a4982dab1 Mon Sep 17 00:00:00 2001 From: Worros Date: Tue, 24 Aug 2010 11:55:30 +0800 Subject: [PATCH] THP: Make THP print a better error message --- pyfpdb/TestHandsPlayers.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pyfpdb/TestHandsPlayers.py b/pyfpdb/TestHandsPlayers.py index e803b03a..5da4d672 100644 --- a/pyfpdb/TestHandsPlayers.py +++ b/pyfpdb/TestHandsPlayers.py @@ -14,14 +14,24 @@ import fpdb_import class FpdbError: def __init__(self): self.errorcount = 0 + self.histogram = {} def error_report(self, filename, hand, stat, ghash, testhash, player): print "Regression Test Error:" print "\tFile: %s" % filename print "\tStat: %s" % stat print "\tPlayer: %s" % player + if filename in self.histogram: + self.histogram[filename] += 1 + else: + self.histogram[filename] = 1 self.errorcount += 1 + def print_histogram(self): + for f in self.histogram: + idx = f.find('regression') + print "(%3d) : %s" %(self.histogram[f], f[idx:]) + def compare(leaf, importer, errors): filename = leaf #print "DEBUG: fileanme: %s" % filename @@ -100,6 +110,7 @@ def main(argv=None): print "---------------------" print "Total Errors: %d" % errors.errorcount print "---------------------" + errors.print_histogram() if __name__ == '__main__': sys.exit(main())