# TODO(arc): These don't work atm, took too long to figure out a fix for now.

# from unittest.mock import AsyncMock, patch
#
# from testgen.testgen import generate_regression_tests_from_function


# @patch("testgen.testgen.openai_client", new_callable=AsyncMock)
# async def test_generate_regression_tests_sorts_and_deduplicates_imports(mock_openai_client):
#     # Mock the OpenAI client's response to simulate the test generation process
#     mock_openai_client.with_options.return_value.chat.completions.create.return_value = AsyncMock(
#         choices=[AsyncMock(message=AsyncMock(content="import os\nimport sys\nimport os"))]
#     )
#
#     # Simulate the function code and name
#     function_code = "def foo():\n    pass"
#     function_name = "foo"
#
#     # Generate the regression tests
#     generated_tests = await generate_regression_tests_from_function(
#         user_id="test_user",
#         function_code=function_code,
#         function_name=function_name,
#         unit_test_package="pytest",
#     )
#
#     # Check if the generated tests have sorted and deduplicated imports
#     expected_code = "import os\nimport sys\n\ndef foo():\n    pass\n"
#     assert generated_tests == expected_code
#
#
# @patch("testgen.testgen.openai_client", new_callable=AsyncMock)
# async def test_generate_regression_tests_keeps_sorted_imports(mock_openai_client):
#     # Mock the OpenAI client's response to simulate the test generation process
#     mock_openai_client.with_options.return_value.chat.completions.create.return_value = AsyncMock(
#         choices=[AsyncMock(message=AsyncMock(content="import json\nimport os\nimport sys"))]
#     )
#
#     # Simulate the function code and name
#     function_code = "def foo():\n    pass"
#     function_name = "foo"
#
#     # Generate the regression tests
#     generated_tests = await generate_regression_tests_from_function(
#         user_id="test_user",
#         function_code=function_code,
#         function_name=function_name,
#         unit_test_package="pytest",
#     )
#
#     # Check if the generated tests have kept the sorted imports
#     expected_code = "import json\nimport os\nimport sys\n\ndef foo():\n    pass\n"
#     assert generated_tests == expected_code
