Skip to content

Commit cd9f555

Browse files
committed
fix: update language name based on updated judge0 API response
1 parent 7d6d751 commit cd9f555

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

ai_eval/backends/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def submit_code(self, code: str, language_label: str) -> str:
1515
1616
Args:
1717
code: The source code to execute
18-
language_label: Human-readable language label (e.g., "Python").
18+
language_label: Human-readable language label (e.g., "Python (3.8.1)").
1919
Implementations map this to their own representation.
2020
2121
Returns:

ai_eval/tests/test_ai_eval.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
def coding_block_data():
2727
"""Fixture for coding block test data."""
2828
return {
29-
"language": "Python",
29+
"language": "Python (3.8.1)",
3030
"question": "ca va?",
3131
"code": "",
3232
"ai_evaluation": "",
@@ -247,7 +247,7 @@ def test_custom_backend_initialization(mock_get):
247247
"""Test CustomServiceBackend initializes with correct config."""
248248
mock_response = Mock()
249249
mock_response.json.return_value = [
250-
{"id": "92", "name": "Python"},
250+
{"id": "92", "name": "Python (3.8.1)"},
251251
{"id": "93", "name": "JavaScript"},
252252
{"id": "91", "name": "Java"},
253253
{"id": "54", "name": "C++"}
@@ -277,7 +277,7 @@ def test_judge0_submit_code(mock_post):
277277
mock_post.return_value = mock_response
278278

279279
backend = Judge0Backend(api_key="test-key")
280-
submission_id = backend.submit_code("print('hello')", "Python")
280+
submission_id = backend.submit_code("print('hello')", "Python (3.8.1)")
281281

282282
assert submission_id == "test-token"
283283
mock_post.assert_called_once()
@@ -312,7 +312,7 @@ def test_custom_submit_code(mock_post, mock_get):
312312
"""Test CustomServiceBackend.submit_code method."""
313313
lang_resp = Mock()
314314
lang_resp.json.return_value = [
315-
{"name": "Python"}, {"name": "JavaScript"}, {"name": "Java"}, {"name": "C++"}
315+
{"name": "Python (3.8.1)"}, {"name": "JavaScript"}, {"name": "Java"}, {"name": "C++"}
316316
]
317317
lang_resp.raise_for_status = Mock()
318318
mock_get.return_value = lang_resp
@@ -327,7 +327,7 @@ def test_custom_submit_code(mock_post, mock_get):
327327
results_endpoint="http://test.com/results/{submission_id}",
328328
languages_endpoint="http://test.com/languages"
329329
)
330-
submission_id = backend.submit_code("print('hello')", "Python")
330+
submission_id = backend.submit_code("print('hello')", "Python (3.8.1)")
331331

332332
assert submission_id == "test-token"
333333
mock_post.assert_called_once()
@@ -338,7 +338,7 @@ def test_custom_backend_language_validation_fails(mock_get):
338338
"""Test CustomServiceBackend raises error for unsupported languages."""
339339
mock_response = Mock()
340340
mock_response.json.return_value = [
341-
{"name": "Python"} # Only Python supported
341+
{"name": "Python (3.8.1)"} # Only Python supported
342342
]
343343
mock_response.raise_for_status = Mock()
344344
mock_get.return_value = mock_response
@@ -360,7 +360,7 @@ def test_custom_get_result(mock_get):
360360
"""Test CustomServiceBackend.get_result method."""
361361
lang_resp = Mock()
362362
lang_resp.json.return_value = [
363-
{"name": "Python"}, {"name": "JavaScript"}, {"name": "Java"}, {"name": "C++"}
363+
{"name": "Python (3.8.1)"}, {"name": "JavaScript"}, {"name": "Java"}, {"name": "C++"}
364364
]
365365
lang_resp.raise_for_status = Mock()
366366

@@ -448,7 +448,7 @@ def test_coding_block_submit_code_uses_backend(mock_get_backend, coding_block_da
448448
result = block.submit_code_handler.__wrapped__(block, data={"user_code": "print('hello')"})
449449

450450
assert result == {"submission_id": "test-submission-id"}
451-
mock_backend.submit_code.assert_called_once_with("print('hello')", "Python")
451+
mock_backend.submit_code.assert_called_once_with("print('hello')", "Python (3.8.1)")
452452

453453

454454
@patch('ai_eval.coding_ai_eval.BackendFactory.get_backend')

ai_eval/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class ProgrammimgLanguage:
2121
class LanguageLabels:
2222
"""Language labels as seen by users."""
2323

24-
Python = "Python"
24+
Python = "Python (3.8.1)"
2525
JavaScript = "JavaScript"
2626
Java = "Java"
2727
CPP = "C++"

0 commit comments

Comments
 (0)