summaryrefslogtreecommitdiff
path: root/tests/test_g2p.py
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2014-12-30 20:17:15 +0100
committerschneefux <schneefux+commit@schneefux.xyz>2014-12-30 20:17:15 +0100
commit9b7bfec7af923812fdcf5c9faeb98c7c611ea6de (patch)
tree3cdbcf02fc217ea70b80f6a901173b1acb92cebf /tests/test_g2p.py
parent87262c75c3e645358e6587b64c8bd2adca9477b2 (diff)
downloadjasper-client-9b7bfec7af923812fdcf5c9faeb98c7c611ea6de.tar.gz
jasper-client-9b7bfec7af923812fdcf5c9faeb98c7c611ea6de.zip
Avoid skipping too many tests (raises test coverage on travis-ci)
Diffstat (limited to 'tests/test_g2p.py')
-rw-r--r--tests/test_g2p.py24
1 files changed, 15 insertions, 9 deletions
diff --git a/tests/test_g2p.py b/tests/test_g2p.py
index 7904cbf..ad1e171 100644
--- a/tests/test_g2p.py
+++ b/tests/test_g2p.py
@@ -15,22 +15,24 @@ def phonetisaurus_installed():
return True
+WORDS = ['GOOD', 'BAD', 'UGLY']
+
+
@unittest.skipUnless(phonetisaurus_installed(),
"Phonetisaurus or fst_model not present")
class TestG2P(unittest.TestCase):
def setUp(self):
- self.g2pconverter = g2p.PhonetisaurusG2P(
+ self.g2pconv = g2p.PhonetisaurusG2P(
**g2p.PhonetisaurusG2P.get_config())
- self.words = ['GOOD', 'BAD', 'UGLY']
def testTranslateWord(self):
- for word in self.words:
- self.assertIn(word, self.g2pconverter.translate(word).keys())
+ for word in WORDS:
+ self.assertIn(word, self.g2pconv.translate(word).keys())
def testTranslateWords(self):
- results = self.g2pconverter.translate(self.words).keys()
- for word in self.words:
+ results = self.g2pconv.translate(WORDS).keys()
+ for word in WORDS:
self.assertIn(word, results)
@@ -58,14 +60,18 @@ class TestPatchedG2P(TestG2P):
with mock.patch.object(g2p.PhonetisaurusG2P, 'get_config',
classmethod(lambda cls: dict(conf +
[('fst_model', f.name)]))):
- super(self.__class__, self).setUp()
+ self.g2pconv = g2p.PhonetisaurusG2P(
+ **g2p.PhonetisaurusG2P.get_config())
def testTranslateWord(self):
with mock.patch('subprocess.Popen',
return_value=TestPatchedG2P.DummyProc()):
- super(self.__class__, self).testTranslateWord()
+ for word in WORDS:
+ self.assertIn(word, self.g2pconv.translate(word).keys())
def testTranslateWords(self):
with mock.patch('subprocess.Popen',
return_value=TestPatchedG2P.DummyProc()):
- super(self.__class__, self).testTranslateWords()
+ results = self.g2pconv.translate(WORDS).keys()
+ for word in WORDS:
+ self.assertIn(word, results)