nidhal baccouri commited on
Commit
33c503f
·
1 Parent(s): ad67197

updated tests

Browse files
Files changed (2) hide show
  1. tests/test_google_trans.py +1 -11
  2. tests/test_libre.py +0 -10
tests/test_google_trans.py CHANGED
@@ -5,8 +5,7 @@
5
  import pytest
6
  from deep_translator import exceptions, GoogleTranslator
7
  from deep_translator.constants import GOOGLE_CODES_TO_LANGUAGES
8
- #from test_data import test_text_standard, TRANSLATED_RESULTS
9
- import random
10
 
11
  test_text_standard = 'Hello world.'
12
 
@@ -130,15 +129,6 @@ def google_translator():
130
  return GoogleTranslator(target='en')
131
 
132
 
133
- def test_random_tranlations_cases_multiple_names():
134
- random_sample_size = 2
135
- d = dict.fromkeys(list(TRANSLATED_RESULTS.keys()))
136
- random_lang_names = random.sample(d.keys(), random_sample_size)
137
- random_subset_dict = {k: TRANSLATED_RESULTS[k] for k in random_lang_names}
138
- for lang, translation in random_subset_dict.items():
139
- assert GoogleTranslator(source='en', target=lang).translate(test_text_standard) == translation
140
-
141
-
142
  def test_content(google_translator):
143
  """Sample pytest test function with the pytest fixture as an argument."""
144
  # from bs4 import BeautifulSoup
 
5
  import pytest
6
  from deep_translator import exceptions, GoogleTranslator
7
  from deep_translator.constants import GOOGLE_CODES_TO_LANGUAGES
8
+
 
9
 
10
  test_text_standard = 'Hello world.'
11
 
 
129
  return GoogleTranslator(target='en')
130
 
131
 
 
 
 
 
 
 
 
 
 
132
  def test_content(google_translator):
133
  """Sample pytest test function with the pytest fixture as an argument."""
134
  # from bs4 import BeautifulSoup
tests/test_libre.py CHANGED
@@ -5,7 +5,6 @@
5
  import pytest
6
  from deep_translator import exceptions, LibreTranslator
7
  from deep_translator.constants import LIBRE_CODES_TO_LANGUAGES
8
- import random
9
 
10
  test_text_standard = 'Hello world.'
11
  TRANSLATED_RESULTS = {
@@ -41,15 +40,6 @@ def test_content(libre):
41
  assert libre.translate(text='good') is not None
42
 
43
 
44
- def test_random_tranlations_cases_multiple_names():
45
- random_sample_size = 2
46
- d = dict.fromkeys(list(TRANSLATED_RESULTS.keys()))
47
- random_lang_names = random.sample(list(d.keys()), random_sample_size)
48
- random_subset_dict = {k: TRANSLATED_RESULTS[k] for k in random_lang_names}
49
- for lang, translation in random_subset_dict.items():
50
- assert LibreTranslator(source='en', target=lang).translate(test_text_standard) == translation
51
-
52
-
53
  def test_inputs():
54
  with pytest.raises(exceptions.LanguageNotSupportedException):
55
  LibreTranslator(source="", target="")
 
5
  import pytest
6
  from deep_translator import exceptions, LibreTranslator
7
  from deep_translator.constants import LIBRE_CODES_TO_LANGUAGES
 
8
 
9
  test_text_standard = 'Hello world.'
10
  TRANSLATED_RESULTS = {
 
40
  assert libre.translate(text='good') is not None
41
 
42
 
 
 
 
 
 
 
 
 
 
43
  def test_inputs():
44
  with pytest.raises(exceptions.LanguageNotSupportedException):
45
  LibreTranslator(source="", target="")