From 4da53f812522e1b8c7fd901b21f0a25006923f25 Mon Sep 17 00:00:00 2001 From: Amar Khamkar <71604396+Amark19@users.noreply.github.com> Date: Sat, 8 Jun 2024 20:23:57 +0530 Subject: [PATCH] updated packages (#103) * updated packages * upgraded flake8 * updated test case --- mysite/tests/test_translators.py | 50 ++++++++++++++----------------- requirements.txt | Bin 2868 -> 2706 bytes 2 files changed, 23 insertions(+), 27 deletions(-) diff --git a/mysite/tests/test_translators.py b/mysite/tests/test_translators.py index c0f12c4..fbe59c2 100644 --- a/mysite/tests/test_translators.py +++ b/mysite/tests/test_translators.py @@ -4,77 +4,73 @@ from django.test import TestCase from django.urls import reverse -ENGLISH_TO_OTHER_TEMPLATE = '../templates/Translator/EnglishToOther/' -HINDI_TO_OTHER_TEMPLATE = '../templates/Translator/HindiToOther/' +ENGLISH_TO_OTHER_TEMPLATE = "../templates/Translator/EnglishToOther/" +HINDI_TO_OTHER_TEMPLATE = "../templates/Translator/HindiToOther/" class BaseTranslatorTestCase(TestCase): def setUp(self): - self.dummy_request = { - 'text': 'My name is Amar' - } + self.dummy_request = {"text": "My name is Amar"} class EnglishToOtherTestCase(TestCase): - dummy_request = { - 'text': 'my name is Amar' - } + dummy_request = {"text": "my name is Amar"} def english_to_other(self, controller_name, expected_text): response = self.client.post(reverse(controller_name), data=self.dummy_request) self.assertEqual(response.status_code, 200) - self.assertTemplateUsed(response, ENGLISH_TO_OTHER_TEMPLATE + controller_name + '_Transl.html') - decoded_html = html.unescape(response.content.decode('utf-8')) + self.assertTemplateUsed( + response, ENGLISH_TO_OTHER_TEMPLATE + controller_name + "_Transl.html" + ) + decoded_html = html.unescape(response.content.decode("utf-8")) self.assertIn(expected_text, decoded_html) def test_english_to_hindi(self): - self.english_to_other('EnglishToHindi', 'मेरा नाम अमर है') + self.english_to_other("EnglishToHindi", "मेरा नाम अमर है") def test_english_to_marathi(self): - self.english_to_other('EnglishToMarathi', 'माझे नाव अमर आहे') + self.english_to_other("EnglishToMarathi", "माझे नाव अमर आहे") def test_english_to_german(self): - self.english_to_other('EnglishToGerman', 'mein Name ist Amar') + self.english_to_other("EnglishToGerman", "mein Name ist Amar") def test_english_to_french(self): - self.english_to_other('EnglishToFrench', "je m'appelle Amar") + self.english_to_other("EnglishToFrench", "je m'appelle Amar") # def test_english_to_arabian(self): - self.english_to_other('EnglishToArabian', 'اسمي عمار') + self.english_to_other("EnglishToArabian", "اسمي عمار") def test_english_to_spanish(self): - self.english_to_other('EnglishToSpanish', 'mi nombre es amar') + self.english_to_other("EnglishToSpanish", "mi nombre es amar") def test_english_to_thai(self): - self.english_to_other('EnglishToThai', 'ฉันชื่ออามาร์') + self.english_to_other("EnglishToThai", "ฉันชื่ออามาร์") class HindiToOtherTestCase(TestCase): - dummy_request = { - 'text': 'यह एक परीक्षण संदेश है' - } + dummy_request = {"text": "यह एक परीक्षण संदेश है"} def hindi_to_other(self, controller_name, expected_text): response = self.client.post(reverse(controller_name), data=self.dummy_request) self.assertEqual(response.status_code, 200) decoded_json = json.loads(response.content) - self.assertEqual(expected_text, decoded_json['ConTex']) + self.assertEqual(expected_text, decoded_json["ConTex"]) def test_hindi_to_english(self): - self.hindi_to_other('HindiToEnglish', 'This is a test message') + self.hindi_to_other("HindiToEnglish", "this is a test message") def test_hindi_to_marathi(self): - self.hindi_to_other('HindiToMarathi', 'हा एक चाचणी संदेश आहे') + self.hindi_to_other("HindiToMarathi", "हा एक चाचणी संदेश आहे") def test_hindi_to_german(self): - self.hindi_to_other('HindiToGerman', 'Dies ist eine Testnachricht') + self.hindi_to_other("HindiToGerman", "Dies ist eine Testnachricht") def test_hindi_to_french(self): - self.hindi_to_other('HindiToFrench', "Ceci est un message test") + self.hindi_to_other("HindiToFrench", "Ceci est un message test") def test_hindi_to_spanish(self): - self.hindi_to_other('HindiToSpanish', 'Este es un mensaje de prueba') + self.hindi_to_other("HindiToSpanish", "Este es un mensaje de prueba") def test_hindi_to_thai(self): - self.hindi_to_other('HindiToThai', 'นี่คือข้อความทดสอบ') + self.hindi_to_other("HindiToThai", "นี่คือข้อความทดสอบ") diff --git a/requirements.txt b/requirements.txt index 53a8ece2760d9c63496f124e7d22a96514898e4e..05fcb64306316bcf8f99f14e471c00baa1f3568b 100644 GIT binary patch delta 77 zcmdlYHc51X1giyu9)saTS$lR9Aj6D7Z(^z`rzwzW1jGgt7e{Z_VpL;fG~67>#LUQO ezB!cnDdXe_)@O`{lkM3W7e8WS-Ymu?#|QwNe-d#3 delta 224 zcmbOvx