Fix test_PokerStars.py

This commit is contained in:
Worros 2009-11-26 22:41:42 +08:00
parent b794d20f6d
commit 5b5216bbe2

View File

@ -3,6 +3,20 @@ import PokerStarsToFpdb
from Hand import * from Hand import *
import py import py
import Configuration
import Database
import fpdb_import
config = Configuration.Config(file = "HUD_config.test.xml")
db = Database.Database(config)
db.recreate_tables()
settings = {}
settings.update(config.get_db_parameters())
settings.update(config.get_tv_parameters())
settings.update(config.get_import_parameters())
settings.update(config.get_default_paths())
#regression-test-files/stars/badugi/ring-fl-badugi.txt #regression-test-files/stars/badugi/ring-fl-badugi.txt
# s0rrow: input: $30.00 end: $22.65 total: ($7.35) # s0rrow: input: $30.00 end: $22.65 total: ($7.35)
#regression-test-files/stars/plo/PLO-6max.txt #regression-test-files/stars/plo/PLO-6max.txt
@ -45,37 +59,17 @@ def testGameInfo():
yield checkGameInfo, hhc, header, info yield checkGameInfo, hhc, header, info
def testHandInfo(): def testFlopImport():
text = u"""PokerStars Game #20461877044: Hold'em No Limit ($1/$2) - 2008/09/16 18:58:01 ET""" importer = fpdb_import.Importer(False, settings, config)
hhc = PokerStarsToFpdb.PokerStars(autostart=False) importer.setDropIndexes("don't drop")
h = HoldemOmahaHand(None, "PokerStars", gametype, text, builtFrom = "Test") importer.setFailOnError(True)
hhc.readHandInfo(h) importer.setThreads(-1)
assert h.handid == '20461877044' importer.addBulkImportImportFileOrDir(
assert h.sitename == 'PokerStars' """regression-test-files/cash/Stars/Flop/NLHE-6max-EUR-0.05-0.10-200911.txt""", site="PokerStars")
assert h.starttime == (2008, 9, 16, 18, 58, 1, 1, 260, -1) importer.addBulkImportImportFileOrDir(
"""regression-test-files/cash/Stars/Flop/NLHE-6max-USD-0.05-0.10-200911.txt""", site="PokerStars")
text = u"""PokerStars Game #18707234955: Razz Limit ($0.50/$1.00) - 2008/07/09 - 21:41:43 (ET) importer.setCallHud(False)
Table 'Lepus II' 8-max""" (stored, dups, partial, errs, ttime) = importer.runImport()
hhc = PokerStarsToFpdb.PokerStars(autostart=False) importer.clearFileList()
h = HoldemOmahaHand(None, "PokerStars", gametype, text, builtFrom = "Test")
hhc.readHandInfo(h)
assert h.handid == '18707234955'
assert h.sitename == 'PokerStars'
assert h.maxseats == 8
assert h.tablename == 'Lepus II'
assert h.starttime == (2008,7 , 9, 21, 41, 43, 2, 191, -1)
text = u"""PokerStars Game #22073591924: Hold'em No Limit ($0.50/$1.00) - 2008/11/16 1:22:21 CET [2008/11/15 19:22:21 ET]
Table 'Caia II' 6-max Seat #2 is the button"""
hhc = PokerStarsToFpdb.PokerStars(autostart=False)
h = HoldemOmahaHand(None, "PokerStars", gametype, text, builtFrom = "Test")
hhc.readHandInfo(h)
assert h.handid == '22073591924'
assert h.sitename == 'PokerStars'
assert h.maxseats == 6
assert h.tablename == 'Caia II'
assert h.buttonpos == '2' # TODO: should this be an int?
assert h.starttime == (2008,11 , 15, 19, 22, 21, 5, 320, -1)
assert 1 == 1