diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2014-12-30 20:25:32 +0100 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2014-12-30 20:25:32 +0100 |
| commit | 026a3217c99f0be2a55afe4097fc881f1587940f (patch) | |
| tree | 3cdbcf02fc217ea70b80f6a901173b1acb92cebf /tests/test_g2p.py | |
| parent | ec3e900b05d07b228f68ed2ab42bfd545ac06b92 (diff) | |
| parent | 9b7bfec7af923812fdcf5c9faeb98c7c611ea6de (diff) | |
| download | jasper-client-026a3217c99f0be2a55afe4097fc881f1587940f.tar.gz jasper-client-026a3217c99f0be2a55afe4097fc881f1587940f.zip | |
Merge pull request #271 from Holzhaus/avoid-unittest-skipping
Avoid skipping too many tests (raises test coverage on travis-ci)
Diffstat (limited to 'tests/test_g2p.py')
| -rw-r--r-- | tests/test_g2p.py | 24 |
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) |
