def test_should_raise_exception_given_no_version_was_found(mocker): mocked_re = mocker.patch("transcriber_wrapper.backends.festival.re") mocked_match = mocked_re.match mocked_match.return_value = None with pytest.raises(VersionNotFoundException): FestivalBackend.version() regex = r".* ([0-9\.]+[0-9]):" target = "Festival Speech Synthesis System: 2.5.0:release December 2017" mocked_match.assert_called_once_with(regex, target)
def test_should_return_long_version(): espeak_path = FestivalBackend.version() assert espeak_path == "2.5.0"