2009-03-10 00:01:58 +01:00
|
|
|
# -*- coding: utf-8 -*-
|
2009-03-11 15:42:49 +01:00
|
|
|
import PokerStarsToFpdb
|
2009-03-14 15:01:40 +01:00
|
|
|
from Hand import *
|
2009-03-10 00:01:58 +01:00
|
|
|
import py
|
|
|
|
|
2009-11-26 15:41:42 +01:00
|
|
|
import Configuration
|
|
|
|
import Database
|
|
|
|
import fpdb_import
|
|
|
|
|
|
|
|
config = Configuration.Config(file = "HUD_config.test.xml")
|
|
|
|
db = Database.Database(config)
|
|
|
|
|
|
|
|
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())
|
|
|
|
|
2009-03-14 12:03:28 +01:00
|
|
|
#regression-test-files/stars/badugi/ring-fl-badugi.txt
|
2009-03-15 06:32:52 +01:00
|
|
|
# s0rrow: input: $30.00 end: $22.65 total: ($7.35)
|
|
|
|
#regression-test-files/stars/plo/PLO-6max.txt
|
|
|
|
# s0rrow: input: $18.35 end: $0 total: ($18.35)
|
|
|
|
# Notes: last hand #25975302416 s0rrow aifp against 2 players
|
2009-03-14 12:03:28 +01:00
|
|
|
|
2009-03-14 15:01:40 +01:00
|
|
|
gametype = {'type':'ring', 'base':'draw', 'category':'badugi', 'limitType':'fl', 'sb':'0.25', 'bb':'0.50','currency':'USD'}
|
|
|
|
text = ""
|
|
|
|
|
|
|
|
hhc = PokerStarsToFpdb.PokerStars(autostart=False)
|
|
|
|
|
2009-08-09 16:19:43 +02:00
|
|
|
h = HoldemOmahaHand(None, "PokerStars", gametype, text, builtFrom = "Test")
|
2009-03-14 15:01:40 +01:00
|
|
|
h.addPlayer("1", "s0rrow", "100000")
|
|
|
|
|
|
|
|
hhc.compilePlayerRegexs(h)
|
|
|
|
|
2009-03-10 00:01:58 +01:00
|
|
|
|
|
|
|
def checkGameInfo(hhc, header, info):
|
|
|
|
assert hhc.determineGameType(header) == info
|
|
|
|
|
|
|
|
def testGameInfo():
|
2009-03-11 15:42:49 +01:00
|
|
|
hhc = PokerStarsToFpdb.PokerStars(autostart=False)
|
2009-03-10 00:01:58 +01:00
|
|
|
pairs = (
|
|
|
|
(u"PokerStars Game #20461877044: Hold'em No Limit ($1/$2) - 2008/09/16 18:58:01 ET",
|
2009-03-11 15:42:49 +01:00
|
|
|
{'type':'ring', 'base':"hold", 'category':'holdem', 'limitType':'nl', 'sb':'1', 'bb':'2', 'currency':'USD'}),
|
|
|
|
|
|
|
|
(u"PokerStars Game #5999635897: HORSE (Omaha Hi/Lo Limit, $2/$4) - 2006/08/21 - 13:59:19 (ET)",
|
2009-03-13 22:42:20 +01:00
|
|
|
{'type':'ring', 'base':'hold', 'category':'omahahilo', 'limitType':'fl', 'sb':'2', 'bb':'4','currency':'USD'}),
|
|
|
|
|
|
|
|
(u"PokerStars Game #25923772706: Badugi Limit ($0.25/$0.50) - 2009/03/13 16:40:58 ET",
|
2009-03-15 06:32:52 +01:00
|
|
|
{'type':'ring', 'base':'draw', 'category':'badugi', 'limitType':'fl', 'sb':'0.25', 'bb':'0.50','currency':'USD'}),
|
|
|
|
|
2009-03-24 15:27:43 +01:00
|
|
|
(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]",
|
|
|
|
{'type':'ring', 'base':'hold', 'category':'holdem', 'limitType':'nl', 'sb':'0.50', 'bb':'1.00','currency':'USD'}),
|
|
|
|
|
2009-03-15 06:32:52 +01:00
|
|
|
(u"PokerStars Game #25974627364: Omaha Pot Limit ($0.05/$0.10) - 2009/03/15 0:29:00 ET",
|
|
|
|
{'type':'ring', 'base':'hold', 'category':'omahahi', 'limitType':'pl', 'sb':'0.05', 'bb':'0.10','currency':'USD'})
|
2009-03-10 00:01:58 +01:00
|
|
|
)
|
|
|
|
for (header, info) in pairs:
|
|
|
|
yield checkGameInfo, hhc, header, info
|
|
|
|
|
2009-03-29 13:20:04 +02:00
|
|
|
|
2009-11-26 15:41:42 +01:00
|
|
|
def testFlopImport():
|
2009-11-26 17:12:57 +01:00
|
|
|
db.recreate_tables()
|
2009-11-26 15:41:42 +01:00
|
|
|
importer = fpdb_import.Importer(False, settings, config)
|
|
|
|
importer.setDropIndexes("don't drop")
|
|
|
|
importer.setFailOnError(True)
|
|
|
|
importer.setThreads(-1)
|
|
|
|
importer.addBulkImportImportFileOrDir(
|
|
|
|
"""regression-test-files/cash/Stars/Flop/NLHE-6max-EUR-0.05-0.10-200911.txt""", site="PokerStars")
|
|
|
|
importer.addBulkImportImportFileOrDir(
|
|
|
|
"""regression-test-files/cash/Stars/Flop/NLHE-6max-USD-0.05-0.10-200911.txt""", site="PokerStars")
|
2009-11-26 15:52:27 +01:00
|
|
|
#importer.addBulkImportImportFileOrDir(
|
|
|
|
# """regression-test-files/tour/Stars/Flop/NLHE-USD-MTT-5r-200710.txt""", site="PokerStars")
|
2009-11-26 17:12:57 +01:00
|
|
|
importer.addBulkImportImportFileOrDir(
|
|
|
|
"""regression-test-files/cash/Stars/Flop/PLO8-6max-USD-0.01-0.02-200911.txt""", site="PokerStars")
|
2009-11-26 15:41:42 +01:00
|
|
|
importer.setCallHud(False)
|
|
|
|
(stored, dups, partial, errs, ttime) = importer.runImport()
|
|
|
|
importer.clearFileList()
|
2009-11-26 17:12:57 +01:00
|
|
|
|
|
|
|
# Should actually do some testing here
|
2009-11-26 15:41:42 +01:00
|
|
|
assert 1 == 1
|
2009-11-26 17:12:57 +01:00
|
|
|
|
|
|
|
def testStudImport():
|
|
|
|
db.recreate_tables()
|
|
|
|
importer = fpdb_import.Importer(False, settings, config)
|
|
|
|
importer.setDropIndexes("don't drop")
|
|
|
|
importer.setFailOnError(True)
|
|
|
|
importer.setThreads(-1)
|
|
|
|
importer.addBulkImportImportFileOrDir(
|
|
|
|
"""regression-test-files/cash/Stars/Stud/7-Stud-USD-0.04-0.08-200911.txt""", site="PokerStars")
|
|
|
|
importer.addBulkImportImportFileOrDir(
|
|
|
|
"""regression-test-files/cash/Stars/Stud/7-StudHL-USD-0.04-0.08-200911.txt""", site="PokerStars")
|
|
|
|
importer.addBulkImportImportFileOrDir(
|
|
|
|
"""regression-test-files/cash/Stars/Stud/Razz-USD-0.04-0.08-200911.txt""", site="PokerStars")
|
|
|
|
importer.setCallHud(False)
|
|
|
|
(stored, dups, partial, errs, ttime) = importer.runImport()
|
|
|
|
importer.clearFileList()
|
|
|
|
|
2009-11-29 08:28:32 +01:00
|
|
|
def testDrawImport():
|
|
|
|
db.recreate_tables()
|
|
|
|
importer = fpdb_import.Importer(False, settings, config)
|
|
|
|
importer.setDropIndexes("don't drop")
|
|
|
|
importer.setFailOnError(True)
|
|
|
|
importer.setThreads(-1)
|
|
|
|
importer.addBulkImportImportFileOrDir(
|
|
|
|
"""regression-test-files/cash/Stars/Draw/3-Draw-Limit-USD-0.10-0.20-200911.txt""", site="PokerStars")
|
2009-11-26 17:12:57 +01:00
|
|
|
# importer.addBulkImportImportFileOrDir(
|
|
|
|
# """regression-test-files/cash/Stars/Draw/5-Carddraw-USD-0.10-0.20-200911.txt""", site="PokerStars")
|
2009-11-29 08:28:32 +01:00
|
|
|
importer.setCallHud(False)
|
|
|
|
(stored, dups, partial, errs, ttime) = importer.runImport()
|
|
|
|
importer.clearFileList()
|