Merge branch 'master' of git://git.assembla.com/fpdboz.git
This commit is contained in:
		
						commit
						4ca4e11591
					
				|  | @ -28,8 +28,8 @@ class Everleaf(HandHistoryConverter): | ||||||
|      |      | ||||||
|     # Static regexes |     # Static regexes | ||||||
|     re_SplitHands  = re.compile(r"\n\n+") |     re_SplitHands  = re.compile(r"\n\n+") | ||||||
|     re_GameInfo    = re.compile(r".*Blinds \$?(?P<SB>[.0-9]+)/\$?(?P<BB>[.0-9]+) (?P<LTYPE>(NL|PL)) (?P<GAME>(Hold\'em|Omaha|7 Card Stud))") |     re_GameInfo    = re.compile(r"^(Blinds )?\$?(?P<SB>[.0-9]+)/\$?(?P<BB>[.0-9]+) ((?P<LTYPE>NL|PL) )?(?P<GAME>(Hold\'em|Omaha|7 Card Stud))", re.MULTILINE) | ||||||
|     re_HandInfo    = re.compile(r".*#(?P<HID>[0-9]+)\n.*\nBlinds \$?(?P<SB>[.0-9]+)/\$?(?P<BB>[.0-9]+) (?P<GAMETYPE>.*) - (?P<DATETIME>\d\d\d\d/\d\d/\d\d - \d\d:\d\d:\d\d)\nTable (?P<TABLE>[- a-zA-Z]+)") |     re_HandInfo    = re.compile(r".*#(?P<HID>[0-9]+)\n.*\n(Blinds )?\$?(?P<SB>[.0-9]+)/\$?(?P<BB>[.0-9]+) (?P<GAMETYPE>.*) - (?P<DATETIME>\d\d\d\d/\d\d/\d\d - \d\d:\d\d:\d\d)\nTable (?P<TABLE>[- a-zA-Z]+)") | ||||||
|     re_Button      = re.compile(r"^Seat (?P<BUTTON>\d+) is the button", re.MULTILINE) |     re_Button      = re.compile(r"^Seat (?P<BUTTON>\d+) is the button", re.MULTILINE) | ||||||
|     re_PlayerInfo  = re.compile(r"^Seat (?P<SEAT>[0-9]+): (?P<PNAME>.*) \(\s+(\$ (?P<CASH>[.0-9]+) USD|new player|All-in) \)", re.MULTILINE) |     re_PlayerInfo  = re.compile(r"^Seat (?P<SEAT>[0-9]+): (?P<PNAME>.*) \(\s+(\$ (?P<CASH>[.0-9]+) USD|new player|All-in) \)", re.MULTILINE) | ||||||
|     re_Board       = re.compile(r"\[ (?P<CARDS>.+) \]") |     re_Board       = re.compile(r"\[ (?P<CARDS>.+) \]") | ||||||
|  |  | ||||||
|  | @ -30,6 +30,7 @@ import fpdb_db | ||||||
| import fpdb_import | import fpdb_import | ||||||
| import fpdb_simple | import fpdb_simple | ||||||
| import FpdbSQLQueries | import FpdbSQLQueries | ||||||
|  | import EverleafToFpdb | ||||||
| import Tables | import Tables | ||||||
| 
 | 
 | ||||||
| import unittest | import unittest | ||||||
|  | @ -52,6 +53,8 @@ class TestSequenceFunctions(unittest.TestCase): | ||||||
|         self.mysqlimporter = fpdb_import.Importer(self, self.mysql_settings, self.c) |         self.mysqlimporter = fpdb_import.Importer(self, self.mysql_settings, self.c) | ||||||
|         self.mysqlimporter.setCallHud(False) |         self.mysqlimporter.setCallHud(False) | ||||||
| 
 | 
 | ||||||
|  |         self.everleaf = EverleafToFpdb.Everleaf(self.c, "Nofile") | ||||||
|  | 
 | ||||||
| #        """Configure Postgres settings/database and establish connection""" | #        """Configure Postgres settings/database and establish connection""" | ||||||
| #        self.pg_settings={ 'db-host':"localhost", 'db-backend':3, 'db-databaseName':"fpdbtest", 'db-user':"fpdb", 'db-password':"fpdb"} | #        self.pg_settings={ 'db-host':"localhost", 'db-backend':3, 'db-databaseName':"fpdbtest", 'db-user':"fpdb", 'db-password':"fpdb"} | ||||||
| #        self.pg_db = fpdb_db.fpdb_db() | #        self.pg_db = fpdb_db.fpdb_db() | ||||||
|  | @ -110,12 +113,57 @@ class TestSequenceFunctions(unittest.TestCase): | ||||||
|         self.failUnless(result == "French", "French (deep) parsed incorrectly. Expected 'French' got: " + str(result)) |         self.failUnless(result == "French", "French (deep) parsed incorrectly. Expected 'French' got: " + str(result)) | ||||||
| #        result = ("French (deep) - $0.25/$0.50 - No Limit Hold'em - Logged In As xxxx") | #        result = ("French (deep) - $0.25/$0.50 - No Limit Hold'em - Logged In As xxxx") | ||||||
| 
 | 
 | ||||||
|     def testImportHandHistoryFiles(self): |     def testEverleafGameInfoRegex(self): | ||||||
|         """Test import of single HH file""" |         cash_nlhe = """Everleaf Gaming Game #55198191 | ||||||
|         self.mysqlimporter.addImportFile("regression-test-files/hand-histories/ps-lhe-ring-3hands.txt") | ***** Hand history for game #55198191 ***** | ||||||
|         self.mysqlimporter.runImport() | Blinds $0.50/$1 NL Hold'em - 2008/09/01 - 10:02:11 | ||||||
|         self.mysqlimporter.addImportDirectory("regression-test-files/hand-histories") | Table Speed Kuala | ||||||
|         self.mysqlimporter.runImport() | Seat 8 is the button | ||||||
|  | Total number of players: 10""" | ||||||
|  |         cash_plo = """Everleaf Gaming Game #65295370 | ||||||
|  | ***** Hand history for game #65295370 ***** | ||||||
|  | Blinds $0.50/$1 PL Omaha - 2008/12/07 - 21:59:48 | ||||||
|  | Table Guanajuato | ||||||
|  | Seat 5 is the button | ||||||
|  | Total number of players: 6""" | ||||||
|  |         cash_flhe = """Everleaf Gaming Game #55809022 | ||||||
|  | ***** Hand history for game #55809022 ***** | ||||||
|  | $1/$2 Hold'em - 2008/09/07 - 08:04:36 | ||||||
|  | Table Jeonju | ||||||
|  | Seat 4 is the button | ||||||
|  | Total number of players: 5 | ||||||
|  | """ | ||||||
|  |         #NLHE | ||||||
|  |         m = self.everleaf.re_GameInfo.search(cash_nlhe) | ||||||
|  |         sb = m.group('SB') | ||||||
|  |         bb = m.group('BB') | ||||||
|  |         ltype = m.group('LTYPE') | ||||||
|  |         game = m.group('GAME') | ||||||
|  | 
 | ||||||
|  |         self.failUnless(sb == "0.50", "SB incorrect, expected: 0.50 got: '" + sb + "'") | ||||||
|  |         self.failUnless(bb == "1", "BB incorrect, expected: 1 got: '" + bb + "'") | ||||||
|  |         self.failUnless(ltype == "NL", "LTYPE incorrect, expected: NL got: '" + ltype + "'") | ||||||
|  |         self.failUnless(game == "Hold\'em", "GAME incorrect, expected: Hold\'em got: '" + game + "'") | ||||||
|  | 
 | ||||||
|  |         #FLHE | ||||||
|  |         m = self.everleaf.re_GameInfo.search(cash_flhe) | ||||||
|  |         sb = m.group('SB') | ||||||
|  |         bb = m.group('BB') | ||||||
|  |         ltype = m.group('LTYPE') | ||||||
|  |         game = m.group('GAME') | ||||||
|  |         print m.groups() | ||||||
|  | 
 | ||||||
|  |         self.failUnless(sb == "1", "SB incorrect, expected: 1 got: '" + sb + "'") | ||||||
|  |         self.failUnless(bb == "2", "BB incorrect, expected: 2 got: '" + bb + "'") | ||||||
|  |         self.failUnless(ltype == None, "LTYPE incorrect, expected: NL got: '%s'" %(ltype)) | ||||||
|  |         self.failUnless(game == "Hold\'em", "GAME incorrect, expected: Hold\'em got: '" + game + "'") | ||||||
|  | 
 | ||||||
|  | #    def testImportHandHistoryFiles(self): | ||||||
|  | #        """Test import of single HH file""" | ||||||
|  | #        self.mysqlimporter.addImportFile("regression-test-files/hand-histories/ps-lhe-ring-3hands.txt") | ||||||
|  | #        self.mysqlimporter.runImport() | ||||||
|  | #        self.mysqlimporter.addImportDirectory("regression-test-files/hand-histories") | ||||||
|  | #        self.mysqlimporter.runImport() | ||||||
| 
 | 
 | ||||||
| #    def testPostgresSQLRecreateTables(self): | #    def testPostgresSQLRecreateTables(self): | ||||||
| #        """Test droping then recreating fpdb table schema""" | #        """Test droping then recreating fpdb table schema""" | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user