Skip to content

Commit 34aeaeb

Browse files
committed
Merge branch 'feature/italian-support'
2 parents 8150ca5 + 39aa1c1 commit 34aeaeb

File tree

3 files changed

+67
-20
lines changed

3 files changed

+67
-20
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
## [Unreleased] - YYYY-MM-DD
99

1010
### Added
11-
11+
* Italian support
1212

1313
### Changed
1414

@@ -22,6 +22,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2222
### Fixed
2323

2424

25+
## [v0.1.3] - 2024-10-06
26+
27+
### Added
28+
* Italian support
29+
2530

2631
## [v0.1.2] - 2024-10-03
2732

ai_tutor.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ def get_directive(explanation_in:str) -> str:
170170
'Spanish': 'Explique en términos para principiantes, sin duplicados, la causa del error en el código enviado como tarea.',
171171
'French': '''Expliquez en termes de débutant, sans doublons, la cause de l'erreur dans le code soumis comme devoir.''',
172172
'German': 'Erklären Sie in Anfängerterminologie ohne Duplikate die Ursache des Fehlers im als Hausaufgabe eingereichten Code.',
173+
'Italian': 'Spiega in termini per principianti, senza duplicati, la causa dell\'errore nel codice inviato come compito.',
173174
'Thai': 'อธิบายด้วยภาษาของผู้เริ่มต้นโดยไม่ซ้ำซ้อนว่าสาเหตุของข้อผิดพลาดในรหัสที่ส่งเป็นการบ้านคืออะไร',
174175
}
175176
return f"{d[explanation_in]}\n"
@@ -203,6 +204,7 @@ def get_report_header(explanation_in:str) -> str:
203204
'Spanish': "Mensaje de error comienza",
204205
'French': '''Message d'erreur commence''',
205206
'German': "Fehlermeldung beginnt",
207+
'Italian': "Messaggio di errore inizia",
206208
'Thai': "ข้อความผิดพลาดเริ่มต้น",
207209
}
208210
return (
@@ -220,6 +222,7 @@ def get_report_footer(explanation_in:str) -> str:
220222
'Spanish': "Mensaje de error termina",
221223
'French': '''Message d'erreur fin''',
222224
'German': "Fehlermeldung endet",
225+
'Italian': "Messaggio di errore finisce",
223226
'Thai': "ข้อความผิดพลาดสิ้นสุด",
224227
}
225228
return (
@@ -242,6 +245,7 @@ def get_code_instruction(
242245
'Spanish': "Inicio del código de envío de tareas",
243246
'French': '''Début du code de soumission des devoirs''',
244247
'German': "Code für die Einreichung von Hausaufgaben von hier aus",
248+
'Italian': "Inizio del codice di invio dei compiti",
245249
'Thai': "การส่งงานเริ่มต้น",
246250
}
247251

@@ -253,6 +257,7 @@ def get_code_instruction(
253257
'Spanish': "Fin del código de envío de tareas",
254258
'French': '''Fin du code de soumission des devoirs''',
255259
'German': "Ende der Hausaufgaben-Einreichungscodes",
260+
'Italian': "Fine del codice di invio dei compiti",
256261
'Thai': "การส่งงานสิ้นสุด",
257262
}
258263

@@ -264,6 +269,7 @@ def get_code_instruction(
264269
'Spanish': "Inicio de la instrucción de la tarea",
265270
'French': '''Début de l'instruction de la tâche''',
266271
'German': "Start der Aufgabenanweisung",
272+
'Italian': "Inizio dell'istruzione dell'assegnazione",
267273
'Thai': "คำแนะนำการบ้านเริ่มต้น",
268274
}
269275

@@ -275,6 +281,7 @@ def get_code_instruction(
275281
'Spanish': "Fin de la instrucción de la tarea",
276282
'French': '''Fin de l'instruction de la tâche''',
277283
'German': "Ende der Aufgabenanweisung",
284+
'Italian': "Fine dell'istruzione dell'assegnazione",
278285
'Thai': "คำแนะนำการบ้านสิ้นสุด",
279286
}
280287

tests/test_ai_tutor.py

Lines changed: 54 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import pathlib
44
import sys
55

6-
from typing import Dict, Union, List
6+
from typing import Callable, Dict, List, Tuple, Union
77

88
import pytest
99

@@ -57,24 +57,30 @@ def test_collect_longrepr(json_dict_div_zero_try_except:Dict):
5757
assert result
5858

5959

60-
@pytest.fixture(params=('Korean', 'English', 'Japanese', 'Chinese', 'Spanish', 'French', 'German', 'Thai'))
60+
@pytest.fixture(params=('Korean', 'English', 'Japanese', 'Chinese', 'Spanish', 'French', 'German', 'Italian', 'Thai'))
6161
def explanation_in(request) -> str:
6262
return request.param.capitalize()
6363

6464

6565
@pytest.fixture
66-
def homework(explanation_in:str) -> str:
66+
def homework(explanation_in:str) -> Tuple[str]:
6767
d = {
68-
'Korean': '숙제',
69-
'English': 'Homework',
70-
'Japanese': '宿題',
71-
'Chinese': '作业',
72-
'Spanish': 'Tarea',
73-
'French': 'Devoir',
74-
'German': 'Hausaufgabe',
75-
'Thai': 'การบ้าน',
68+
'Korean': ('숙제',),
69+
'English': ('Homework',),
70+
'Japanese': ('宿題',),
71+
'Chinese': ('作业',),
72+
'Spanish': ('Tarea',),
73+
'French': ('Devoir',),
74+
'German': ('Hausaufgabe',),
75+
'Italian': ('Compito', 'Compiti'),
76+
'Thai': ('การบ้าน',),
7677
}
77-
return d[explanation_in].lower()
78+
return tuple(
79+
map(
80+
lambda x: x.lower(),
81+
d[explanation_in]
82+
)
83+
)
7884

7985

8086
@pytest.fixture
@@ -87,19 +93,36 @@ def msg(explanation_in:str) -> str:
8793
'Spanish': 'Mensaje',
8894
'French': 'Message',
8995
'German': 'Fehlermeldung',
96+
'Italian': 'Messaggio',
9097
'Thai': 'ข้อความ',
9198
}
9299
return d[explanation_in].lower()
93100

94101

95-
def test_get_instruction(explanation_in, homework,):
102+
def test_get_directive(explanation_in:str, homework:Tuple[str]):
103+
result = ai_tutor.get_directive(explanation_in=explanation_in)
104+
105+
assert any(
106+
map(
107+
lambda x: x in result.lower(),
108+
homework
109+
)
110+
)
111+
112+
113+
def test_get_instruction(explanation_in:str, homework:Tuple[str],):
96114
result = ai_tutor.get_directive(explanation_in=explanation_in)
97115

98-
assert homework in result.lower()
116+
assert any(
117+
map(
118+
lambda x: x in result.lower(),
119+
homework
120+
)
121+
)
99122

100123

101124
@pytest.mark.parametrize("func", (ai_tutor.get_report_header, ai_tutor.get_report_footer))
102-
def test_get_report__header__footer(explanation_in, msg, func):
125+
def test_get_report__header__footer(explanation_in:str, msg:str, func:Callable):
103126

104127
result = func(explanation_in=explanation_in)
105128

@@ -126,6 +149,7 @@ def instruction(explanation_in:str) -> str:
126149
'Spanish': 'instrucción',
127150
'French': 'instruction',
128151
'German': 'Aufgabenanweisung',
152+
'Italian': 'istruzione',
129153
'Thai': 'แนะนำ',
130154
}
131155
return d[explanation_in].lower()
@@ -135,7 +159,7 @@ def test_get_code_instruction(
135159
sample_student_code_path:pathlib.Path,
136160
sample_readme_path:pathlib.Path,
137161
explanation_in:str,
138-
homework:str,
162+
homework:Tuple[str],
139163
instruction:str,
140164
):
141165

@@ -145,7 +169,12 @@ def test_get_code_instruction(
145169
explanation_in=explanation_in
146170
).lower()
147171

148-
assert homework in result
172+
assert any(
173+
map(
174+
lambda x: x in result,
175+
homework
176+
)
177+
)
149178
assert instruction in result
150179

151180

@@ -155,7 +184,8 @@ def test_get_the_question(
155184
sample_student_code_path:pathlib.Path,
156185
sample_readme_path:pathlib.Path,
157186
explanation_in:str,
158-
homework:str, msg:str,
187+
homework:Tuple[str],
188+
msg:str,
159189
instruction:str,
160190
):
161191
result = ai_tutor.get_the_question(
@@ -165,7 +195,12 @@ def test_get_the_question(
165195
explanation_in=explanation_in,
166196
).lower()
167197

168-
assert homework in result
198+
assert any(
199+
map(
200+
lambda x: x in result,
201+
homework
202+
)
203+
)
169204
assert msg in result
170205
assert instruction in result
171206

0 commit comments

Comments
 (0)