Add regression test for clean_title function and revert regex change
This commit is contained in:
parent
ff1a2c42b8
commit
6afe8f0240
|
@ -30,6 +30,7 @@ import fpdb_db
|
|||
import fpdb_import
|
||||
import fpdb_simple
|
||||
import FpdbSQLQueries
|
||||
import Tables
|
||||
|
||||
import unittest
|
||||
|
||||
|
@ -89,6 +90,10 @@ class TestSequenceFunctions(unittest.TestCase):
|
|||
self.failUnless(result==datetime.datetime(2008,8,17,6,14,43),
|
||||
"Date incorrect, expected: 2008-08-17 01:14:43 got: " + str(result))
|
||||
|
||||
def testTableDetection(self):
|
||||
result = Tables.clean_title("French (deep)")
|
||||
self.failUnless(result == "French", "French (deep) parsed incorrectly. Expected 'French' got: " + str(result))
|
||||
|
||||
def testImportHandHistoryFiles(self):
|
||||
"""Test import of single HH file"""
|
||||
self.mysqlimporter.addImportFile("regression-test-files/hand-histories/ps-lhe-ring-3hands.txt")
|
||||
|
|
|
@ -339,9 +339,9 @@ def fulltilt_decode_table(tw):
|
|||
def clean_title(name):
|
||||
"""Clean the little info strings from the table name."""
|
||||
# these strings could go in a config file
|
||||
for pattern in [' (6 max)', ' (heads up)', ' (deep)',
|
||||
' (deep hu)', ' (deep 6)', ' (2)',
|
||||
' (edu)', ' (edu, 6 max)', ' (6)',
|
||||
for pattern in [' \(6 max\)', ' \(heads up\)', ' \(deep\)',
|
||||
' \(deep hu\)', ' \(deep 6\)', ' \(2\)',
|
||||
' \(edu\)', ' \(edu, 6 max\)', ' \(6\)',
|
||||
' no all-in', ' fast', ',', ' 50BB min', '\s+$']:
|
||||
name = re.sub(pattern, '', name)
|
||||
name = name.rstrip()
|
||||
|
|
Loading…
Reference in New Issue
Block a user