|
5 | 5 | from debug_gym.gym.envs.env import RepoEnv
|
6 | 6 | from debug_gym.gym.utils import (
|
7 | 7 | _walk,
|
8 |
| - clean_code, |
9 | 8 | cleanup_pytest_output,
|
10 | 9 | create_ignore_file,
|
11 | 10 | extract_max_score_from_pytest_output,
|
|
15 | 14 | is_subdirectory,
|
16 | 15 | make_file_matcher,
|
17 | 16 | show_line_number,
|
18 |
| - unescape, |
19 | 17 | )
|
20 | 18 |
|
21 | 19 |
|
22 |
| -@pytest.mark.parametrize( |
23 |
| - "code, expected", |
24 |
| - [ |
25 |
| - ("def foo(): \n return 42 \n", "def foo():\n return 42\n"), |
26 |
| - ("", ""), |
27 |
| - ("def foo():\n return 42", "def foo():\n return 42"), |
28 |
| - ("def foo(): \n return 42 \n\n", "def foo():\n return 42\n\n"), |
29 |
| - ("def foo():\\n return 42\\n", "def foo():\n return 42\n"), |
30 |
| - ], |
31 |
| -) |
32 |
| -def test_clean_code(code, expected): |
33 |
| - assert clean_code(code) == expected |
34 |
| - |
35 |
| - |
36 | 20 | def test_show_line_number_empty_code_string():
|
37 | 21 | # code_string is empty
|
38 | 22 | with pytest.raises(
|
@@ -569,25 +553,6 @@ def test_walk():
|
569 | 553 | assert path_list == expected
|
570 | 554 |
|
571 | 555 |
|
572 |
| -def test_unescape_surrogate_pairs(): |
573 |
| - # Test with regular string |
574 |
| - regular_string = "This is a regular string with escapes \\n\\t" |
575 |
| - assert unescape(regular_string) == "This is a regular string with escapes \n\t" |
576 |
| - |
577 |
| - # Test with surrogate pairs that would cause UTF-8 encoding issues |
578 |
| - surrogate_string = "Test with surrogate \\ud800\\udc00 pair" |
579 |
| - result = unescape(surrogate_string) |
580 |
| - |
581 |
| - # Verify we can encode the result to UTF-8 without errors |
582 |
| - try: |
583 |
| - result.encode("utf-8") |
584 |
| - except UnicodeEncodeError: |
585 |
| - assert False, "Unescaped string still has invalid surrogate pairs" |
586 |
| - |
587 |
| - # The result should replace the surrogate with a replacement character |
588 |
| - assert "Test with surrogate" in result |
589 |
| - |
590 |
| - |
591 | 556 | def test_filter_non_utf8():
|
592 | 557 | """Test the filter_non_utf8 function with various inputs."""
|
593 | 558 |
|
|
0 commit comments