diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2014-10-01 14:11:50 +0200 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2014-10-08 20:53:09 +0200 |
| commit | 30133ec0db993eee5bc9ada8b004f910d0a97c5a (patch) | |
| tree | e35bb31a91b9bb572cb61b87b343eaafe648d61e | |
| parent | 210327ebb4f58b84ff5f38541beda57a06ee5a69 (diff) | |
| download | jasper-client-30133ec0db993eee5bc9ada8b004f910d0a97c5a.tar.gz jasper-client-30133ec0db993eee5bc9ada8b004f910d0a97c5a.zip | |
Fix G2P testcases, do not depend on fixed translation string
| -rw-r--r-- | client/test.py | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/client/test.py b/client/test.py index c08866f..7f31f37 100644 --- a/client/test.py +++ b/client/test.py @@ -86,22 +86,17 @@ class TestMic(unittest.TestCase): class TestG2P(unittest.TestCase): def setUp(self): - self.translations = { - 'GOOD': 'G UH D', - 'BAD': 'B AE D', - 'UGLY': 'AH G L IY' - } + self.g2pconverter = g2p.PhonetisaurusG2P(**g2p.PhonetisaurusG2P.get_config()) + self.words = ['GOOD', 'BAD', 'UGLY'] def testTranslateWord(self): - for word in self.translations: - translation = self.translations[word] - self.assertEqual(g2p.translateWord(word), translation) + for word in self.words: + self.assertIn(word, self.g2pconverter.translate(word).keys()) def testTranslateWords(self): - words = self.translations.keys() - # preserve ordering - translations = [self.translations[w] for w in words] - self.assertEqual(g2p.translateWords(words), translations) + results = self.g2pconverter.translate(self.words).keys() + for word in self.words: + self.assertIn(word, results) class TestDiagnose(unittest.TestCase): |
