diff --git a/pyfpdb/RegressionTest.py b/pyfpdb/RegressionTest.py index 2b09d248..09e195cd 100644 --- a/pyfpdb/RegressionTest.py +++ b/pyfpdb/RegressionTest.py @@ -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") diff --git a/pyfpdb/Tables.py b/pyfpdb/Tables.py index 8bf85a89..a626b043 100755 --- a/pyfpdb/Tables.py +++ b/pyfpdb/Tables.py @@ -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()