Merge branch 'carl'

This commit is contained in:
steffen123 2010-08-29 14:30:25 +02:00
commit 4c2941cdaa
2 changed files with 27 additions and 13 deletions

View File

@ -225,13 +225,14 @@ class PokerStars(HandHistoryConverter):
def readHandInfo(self, hand): def readHandInfo(self, hand):
info = {} info = {}
m = self.re_HandInfo.search(hand.handText,re.DOTALL) m = self.re_HandInfo.search(hand.handText,re.DOTALL)
if m: m2 = self.re_GameInfo.search(hand.handText)
info.update(m.groupdict()) if m is None or m2 is None:
else: logging.info("Didn't match re_HandInfo")
pass # throw an exception here, eh? logging.info(hand.handText)
m = self.re_GameInfo.search(hand.handText) raise FpdbParseError("No match in readHandInfo.")
if m:
info.update(m.groupdict()) info.update(m.groupdict())
info.update(m2.groupdict())
log.debug("readHandInfo: %s" % info) log.debug("readHandInfo: %s" % info)
for key in info: for key in info:

View File

@ -12,7 +12,8 @@ import fpdb_import
class FpdbError: class FpdbError:
def __init__(self): def __init__(self, sitename):
self.site = sitename
self.errorcount = 0 self.errorcount = 0
self.histogram = {} self.histogram = {}
@ -28,6 +29,7 @@ class FpdbError:
self.errorcount += 1 self.errorcount += 1
def print_histogram(self): def print_histogram(self):
print "%s:" % self.site
for f in self.histogram: for f in self.histogram:
idx = f.find('regression') idx = f.find('regression')
print "(%3d) : %s" %(self.histogram[f], f[idx:]) print "(%3d) : %s" %(self.histogram[f], f[idx:])
@ -103,14 +105,25 @@ def main(argv=None):
importer.setCallHud(False) importer.setCallHud(False)
importer.setFakeCacheHHC(True) importer.setFakeCacheHHC(True)
errors = FpdbError() PokerStarsErrors = FpdbError('PokerStars')
FTPErrors = FpdbError('Full Tilt Poker')
PartyPokerErrors = FpdbError('Party Poker')
BetfairErrors = FpdbError('Betfair')
walk_testfiles("regression-test-files/cash/Stars/", compare, importer, errors) walk_testfiles("regression-test-files/cash/Stars/", compare, importer, PokerStarsErrors)
walk_testfiles("regression-test-files/cash/FTP/", compare, importer, FTPErrors)
walk_testfiles("regression-test-files/cash/PartyPoker/", compare, importer, PartyPokerErrors)
walk_testfiles("regression-test-files/cash/Betfair/", compare, importer, BetfairErrors)
totalerrors = PokerStarsErrors.errorcount + FTPErrors.errorcount + PartyPokerErrors.errorcount + BetfairErrors.errorcount
print "---------------------" print "---------------------"
print "Total Errors: %d" % errors.errorcount print "Total Errors: %d" % totalerrors
print "---------------------" print "---------------------"
errors.print_histogram() PokerStarsErrors.print_histogram()
FTPErrors.print_histogram()
PartyPokerErrors.print_histogram()
BetfairErrors.print_histogram()
if __name__ == '__main__': if __name__ == '__main__':
sys.exit(main()) sys.exit(main())