ad1b284a09bfa848c5589f0d82117e382bf9e32c,tests/test_translate.py,TestTranslator,test_failed_translation_raises_not_translated,#TestTranslator#Any#,47
Before Change
""n0tv\\u0026l1d","translit":"","
""src_translit":""}],"
""src":"en","server_time":2}")
text = unicode(" n0tv&l1d ")
assert_raises(NotTranslated,
self.translator.translate, text, to_lang="es")
assert_true(mock_get_json5.called_once)
After Change
@mock.patch("textblob.translate.Translator._request")
def test_failed_translation_raises_not_translated(self, mock_request):
failed_responses = ["""", "[""]", "["",""]", "" n0tv&l1d ""]
mock_request.side_effect = failed_responses
text = " n0tv&l1d "
for response in failed_responses:
assert_raises(NotTranslated,
self.translator.translate, text, to_lang="es")
assert_equal(mock_request.call_count, len(failed_responses))
@mock.patch("textblob.translate.Translator._request")
def test_tk_parameter_included_in_requests(self, mock_request):
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 3
Instances
Project Name: sloria/TextBlob
Commit Name: ad1b284a09bfa848c5589f0d82117e382bf9e32c
Time: 2016-02-16
Author: alopez@smartvel.com
File Name: tests/test_translate.py
Class Name: TestTranslator
Method Name: test_failed_translation_raises_not_translated
Project Name: UFAL-DSG/tgen
Commit Name: bebaba130ab074963772235c9b775ad1a7654f6a
Time: 2014-08-26
Author: odusek@ufal.mff.cuni.cz
File Name: tgen/features.py
Class Name:
Method Name: presence
Project Name: leonsim/simhash
Commit Name: 6e8898b82f4591fe2256ca56be3c98836fe94b88
Time: 2017-10-31
Author: akellne@users.noreply.github.com
File Name: simhash/__init__.py
Class Name: Simhash
Method Name: __init__