From c5412caa1449285e29091444d7179dc1f9aa0288 Mon Sep 17 00:00:00 2001 From: Worros Date: Fri, 3 Sep 2010 14:31:52 +0800 Subject: [PATCH] THP + test config: Add suppor for Carbon Make THP script more robust when testing stats --- pyfpdb/HUD_config.test.xml | 1 + pyfpdb/TestHandsPlayers.py | 20 +++++++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/pyfpdb/HUD_config.test.xml b/pyfpdb/HUD_config.test.xml index 38d808c0..92d994ec 100644 --- a/pyfpdb/HUD_config.test.xml +++ b/pyfpdb/HUD_config.test.xml @@ -575,6 +575,7 @@ Left-Drag to Move" + diff --git a/pyfpdb/TestHandsPlayers.py b/pyfpdb/TestHandsPlayers.py index 4f2ad9ba..887ab7db 100755 --- a/pyfpdb/TestHandsPlayers.py +++ b/pyfpdb/TestHandsPlayers.py @@ -85,12 +85,15 @@ def compare(leaf, importer, errors, site): for stat in pstat: #print "pstat[%s][%s]: %s == %s" % (p, stat, pstat[stat], teststat[stat]) - if pstat[stat] == teststat[stat]: - # The stats match - continue - pass - else: - # Stats don't match - Doh! - errors.error_report(filename, hand, stat, ghash, testhash, p) + try: + if pstat[stat] == teststat[stat]: + # The stats match - continue + pass + else: + # Stats don't match - Doh! + errors.error_report(filename, hand, stat, ghash, testhash, p) + except KeyError, e: + errors.error_report(filename, False, "KeyError: '%s'" % stat, False, False, p) if errs > 0: errors.error_report(filename, False, "Parse", False, False, False) @@ -134,6 +137,7 @@ def main(argv=None): OnGameErrors = FpdbError('OnGame') AbsoluteErrors = FpdbError('Absolute Poker') EverleafErrors = FpdbError('Everleaf Poker') + CarbonErrors = FpdbError('Carbon') walk_testfiles("regression-test-files/cash/Stars/", compare, importer, PokerStarsErrors, "PokerStars") walk_testfiles("regression-test-files/tour/Stars/", compare, importer, PokerStarsErrors, "PokerStars") @@ -145,8 +149,9 @@ def main(argv=None): walk_testfiles("regression-test-files/cash/OnGame/", compare, importer, OnGameErrors, "OnGame") walk_testfiles("regression-test-files/cash/Absolute/", compare, importer, AbsoluteErrors, "Absolute") walk_testfiles("regression-test-files/cash/Everleaf/", compare, importer, EverleafErrors, "Everleaf") + walk_testfiles("regression-test-files/cash/Carbon/", compare, importer, CarbonErrors, "Carbon") - totalerrors = PokerStarsErrors.errorcount + FTPErrors.errorcount + PartyPokerErrors.errorcount + BetfairErrors.errorcount + OnGameErrors.errorcount + AbsoluteErrors.errorcount + EverleafErrors.errorcount + totalerrors = PokerStarsErrors.errorcount + FTPErrors.errorcount + PartyPokerErrors.errorcount + BetfairErrors.errorcount + OnGameErrors.errorcount + AbsoluteErrors.errorcount + EverleafErrors.errorcount + CarbonErrors.errorcount print "---------------------" print "Total Errors: %d" % totalerrors @@ -158,6 +163,7 @@ def main(argv=None): OnGameErrors.print_histogram() AbsoluteErrors.print_histogram() EverleafErrors.print_histogram() + CarbonErrors.print_histogram() if __name__ == '__main__': sys.exit(main())