26
26
def coding_block_data ():
27
27
"""Fixture for coding block test data."""
28
28
return {
29
- "language" : "Python" ,
29
+ "language" : "Python (3.8.1) " ,
30
30
"question" : "ca va?" ,
31
31
"code" : "" ,
32
32
"ai_evaluation" : "" ,
@@ -247,7 +247,7 @@ def test_custom_backend_initialization(mock_get):
247
247
"""Test CustomServiceBackend initializes with correct config."""
248
248
mock_response = Mock ()
249
249
mock_response .json .return_value = [
250
- {"id" : "92" , "name" : "Python" },
250
+ {"id" : "92" , "name" : "Python (3.8.1) " },
251
251
{"id" : "93" , "name" : "JavaScript" },
252
252
{"id" : "91" , "name" : "Java" },
253
253
{"id" : "54" , "name" : "C++" }
@@ -277,7 +277,7 @@ def test_judge0_submit_code(mock_post):
277
277
mock_post .return_value = mock_response
278
278
279
279
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) " )
281
281
282
282
assert submission_id == "test-token"
283
283
mock_post .assert_called_once ()
@@ -312,7 +312,7 @@ def test_custom_submit_code(mock_post, mock_get):
312
312
"""Test CustomServiceBackend.submit_code method."""
313
313
lang_resp = Mock ()
314
314
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++" }
316
316
]
317
317
lang_resp .raise_for_status = Mock ()
318
318
mock_get .return_value = lang_resp
@@ -327,7 +327,7 @@ def test_custom_submit_code(mock_post, mock_get):
327
327
results_endpoint = "http://test.com/results/{submission_id}" ,
328
328
languages_endpoint = "http://test.com/languages"
329
329
)
330
- submission_id = backend .submit_code ("print('hello')" , "Python" )
330
+ submission_id = backend .submit_code ("print('hello')" , "Python (3.8.1) " )
331
331
332
332
assert submission_id == "test-token"
333
333
mock_post .assert_called_once ()
@@ -338,7 +338,7 @@ def test_custom_backend_language_validation_fails(mock_get):
338
338
"""Test CustomServiceBackend raises error for unsupported languages."""
339
339
mock_response = Mock ()
340
340
mock_response .json .return_value = [
341
- {"name" : "Python" } # Only Python supported
341
+ {"name" : "Python (3.8.1) " } # Only Python supported
342
342
]
343
343
mock_response .raise_for_status = Mock ()
344
344
mock_get .return_value = mock_response
@@ -360,7 +360,7 @@ def test_custom_get_result(mock_get):
360
360
"""Test CustomServiceBackend.get_result method."""
361
361
lang_resp = Mock ()
362
362
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++" }
364
364
]
365
365
lang_resp .raise_for_status = Mock ()
366
366
@@ -448,7 +448,7 @@ def test_coding_block_submit_code_uses_backend(mock_get_backend, coding_block_da
448
448
result = block .submit_code_handler .__wrapped__ (block , data = {"user_code" : "print('hello')" })
449
449
450
450
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) " )
452
452
453
453
454
454
@patch ('ai_eval.coding_ai_eval.BackendFactory.get_backend' )
0 commit comments