How to use test_get_version method in avocado

Best Python code snippet using avocado_python

test_phonemizer.py

Source:test_phonemizer.py Github

copy

Full Screen

...43 def test_name(self):44 self.assertEqual(self.phonemizer.name(), "espeak")45 def test_get_supported_languages(self):46 self.assertIsInstance(self.phonemizer.supported_languages(), dict)47 def test_get_version(self):48 self.assertIsInstance(self.phonemizer.version(), str)49 def test_is_available(self):50 self.assertTrue(self.phonemizer.is_available())51class TestEspeakNgPhonemizer(unittest.TestCase):52 def setUp(self):53 self.phonemizer = ESpeak(language="en-us", backend="espeak-ng")54 for text, ph in zip(EXAMPLE_TEXTs, EXPECTED_ESPEAKNG_PHONEMES):55 phonemes = self.phonemizer.phonemize(text)56 self.assertEqual(phonemes, ph)57 # multiple punctuations58 text = "Be a voice, not an! echo?"59 gt = "biː ɐ vˈɔɪs, nˈɑːt æn! ˈɛkoʊ?"60 output = self.phonemizer.phonemize(text, separator="|")61 output = output.replace("|", "")62 self.assertEqual(output, gt)63 # not ending with punctuation64 text = "Be a voice, not an! echo"65 gt = "biː ɐ vˈɔɪs, nˈɑːt æn! ˈɛkoʊ"66 output = self.phonemizer.phonemize(text, separator="")67 self.assertEqual(output, gt)68 # extra space after the sentence69 text = "Be a voice, not an! echo. "70 gt = "biː ɐ vˈɔɪs, nˈɑːt æn! ˈɛkoʊ."71 output = self.phonemizer.phonemize(text, separator="")72 self.assertEqual(output, gt)73 def test_name(self):74 self.assertEqual(self.phonemizer.name(), "espeak")75 def test_get_supported_languages(self):76 self.assertIsInstance(self.phonemizer.supported_languages(), dict)77 def test_get_version(self):78 self.assertIsInstance(self.phonemizer.version(), str)79 def test_is_available(self):80 self.assertTrue(self.phonemizer.is_available())81class TestGruutPhonemizer(unittest.TestCase):82 def setUp(self):83 self.phonemizer = Gruut(language="en-us", use_espeak_phonemes=True, keep_stress=False)84 self.EXPECTED_PHONEMES = [85 "ɹ|i|ː|s|ə|n|t| ɹ|ᵻ|s|ɜ|ː|t|ʃ| æ|ɾ| h|ɑ|ː|ɹ|v|ɚ|d| h|ɐ|z| ʃ|o|ʊ|n| m|ɛ|d|ᵻ|t|e|ɪ|ɾ|ɪ|ŋ",86 "f|ɔ|ː|ɹ| æ|z| l|ɪ|ɾ|ə|l| æ|z| e|ɪ|t| w|i|ː|k|s| k|æ|ŋ| æ|k|t|ʃ|u|ː|ə|l|i| ɪ|ŋ|k|ɹ|i|ː|s, ð|ə| ɡ|ɹ|e|ɪ| m|æ|ɾ|ɚ",87 "ɪ|n| ð|ə| p|ɑ|ː|ɹ|t|s| ʌ|v| ð|ə| b|ɹ|e|ɪ|n| ɹ|ᵻ|s|p|ɑ|ː|n|s|ᵻ|b|ə|l",88 "f|ɔ|ː|ɹ| ɪ|m|o|ʊ|ʃ|ə|n|ə|l| ɹ|ɛ|ɡ|j|ʊ|l|e|ɪ|ʃ|ə|n| æ|n|d| l|ɜ|ː|n|ɪ|ŋ!",89 ]90 def test_phonemize(self):91 for text, ph in zip(EXAMPLE_TEXTs, self.EXPECTED_PHONEMES):92 phonemes = self.phonemizer.phonemize(text, separator="|")93 self.assertEqual(phonemes, ph)94 # multiple punctuations95 text = "Be a voice, not an! echo?"96 gt = "biː ɐ vɔɪs, nɑːt ɐn! ɛkoʊ?"97 output = self.phonemizer.phonemize(text, separator="|")98 output = output.replace("|", "")99 self.assertEqual(output, gt)100 # not ending with punctuation101 text = "Be a voice, not an! echo"102 gt = "biː ɐ vɔɪs, nɑːt ɐn! ɛkoʊ"103 output = self.phonemizer.phonemize(text, separator="")104 self.assertEqual(output, gt)105 # extra space after the sentence106 text = "Be a voice, not an! echo. "107 gt = "biː ɐ vɔɪs, nɑːt ɐn! ɛkoʊ."108 output = self.phonemizer.phonemize(text, separator="")109 self.assertEqual(output, gt)110 def test_name(self):111 self.assertEqual(self.phonemizer.name(), "gruut")112 def test_get_supported_languages(self):113 self.assertIsInstance(self.phonemizer.supported_languages(), list)114 def test_get_version(self):115 self.assertIsInstance(self.phonemizer.version(), str)116 def test_is_available(self):117 self.assertTrue(self.phonemizer.is_available())118class TestJA_JPPhonemizer(unittest.TestCase):119 def setUp(self):120 self.phonemizer = JA_JP_Phonemizer()121 self._TEST_CASES = """122 どちらに行きますか?/dochiraniikimasuka?123 今日は温泉に、行きます。/kyo:waoNseNni,ikimasu.124 「A」から「Z」までです。/e:karazeqtomadedesu.125 そうですね!/so:desune!126 クジラは哺乳類です。/kujirawahonyu:ruidesu.127 ヴィディオを見ます。/bidioomimasu.128 今日は8月22日です/kyo:wahachigatsuniju:ninichidesu129 xyzとαβγ/eqkusuwaizeqtotoarufabe:tagaNma130 値段は$12.34です/nedaNwaju:niteNsaNyoNdorudesu131 """132 def test_phonemize(self):133 for line in self._TEST_CASES.strip().split("\n"):134 text, phone = line.split("/")135 self.assertEqual(self.phonemizer.phonemize(text, separator=""), phone)136 def test_name(self):137 self.assertEqual(self.phonemizer.name(), "ja_jp_phonemizer")138 def test_get_supported_languages(self):139 self.assertIsInstance(self.phonemizer.supported_languages(), dict)140 def test_get_version(self):141 self.assertIsInstance(self.phonemizer.version(), str)142 def test_is_available(self):143 self.assertTrue(self.phonemizer.is_available())144class TestZH_CN_Phonemizer(unittest.TestCase):145 def setUp(self):146 self.phonemizer = ZH_CN_Phonemizer()147 self._TEST_CASES = ""148 def test_phonemize(self):149 # TODO: implement ZH phonemizer tests150 pass151 def test_name(self):152 self.assertEqual(self.phonemizer.name(), "zh_cn_phonemizer")153 def test_get_supported_languages(self):154 self.assertIsInstance(self.phonemizer.supported_languages(), dict)155 def test_get_version(self):156 self.assertIsInstance(self.phonemizer.version(), str)157 def test_is_available(self):...

Full Screen

Full Screen

test_setup.py

Source:test_setup.py Github

copy

Full Screen

...48 version_file.write(cls.version_data)49class TestValidVersion(TestCase):50 """Test a valid version number with an epoch."""51 version_data = "__version__ = '1.2.3'\n"52 def test_get_version(self):53 self.assertEqual('1.2.3', get_version("dummy"))54class TestEpochVersion(TestCase):55 """Test a valid version number with an epoch."""56 version_data = "__version__ = '2!2016.1.27rc2'\n"57 def test_get_version(self):58 self.assertEqual('2!2016.1.27rc2', get_version("dummy"))59class TestDoubleQuotes(TestCase):60 """Test a version number enclosed by double quotes."""61 version_data = '__version__ = "1.2.3"\n'62 def test_get_version(self):63 self.assertEqual('1.2.3', get_version("dummy"))64class TestTripleQuotes(TestCase):65 """Test a version number enclosed by triple quotes."""66 version_data = '__version__ = """1.2.3"""\n'67 def test_get_version(self):68 self.assertEqual('1.2.3', get_version("dummy"))69class TestRawString(TestCase):70 """Test a version number enclosed by a raw quoted string."""71 version_data = "__version__ = r'1.2.3'\n"72 def test_get_version(self):73 self.assertEqual('1.2.3', get_version("dummy"))74class TestMismatchedQuotes(TestCase):75 """Test a version number enclosed by mismatched quotes.76 In this case the version number is invalid and get_version77 returns None.78 """79 version_data = '__version__ = "1.2.3\'\n'80 def test_get_version(self):81 self.assertIsNone(get_version("dummy"))82if __name__ == "__main__":...

Full Screen

Full Screen

test_version.py

Source:test_version.py Github

copy

Full Screen

...16# under the License.17# 18from version import get_version19from pytest_mock import mocker20def test_get_version(mocker):21 mock_check_output = mocker.patch("version.check_output")22 mock_check_output.return_value = "v0.4.2-32-ga2ccd08"23 version = get_version()24 assert version == "0.4.2.post32"25def test_get_version(mocker):26 mock_check_output = mocker.patch("version.check_output")27 mock_check_output.return_value = "v0.4.2-32-ga2ccd08-dirty"28 version = get_version()...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run avocado automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful