import ast
import unittest

from django.test import TestCase

from testgen.testgen import any_ellipsis_in_ast, ellipsis_in_ast_not_types


class TestEllipsisInAst(TestCase):
    @unittest.skip
    def test_ellipsis_in_ast_with_ellipsis(self) -> None:
        """Test that ellipsis_in_ast detects an ellipsis in the function body."""
        code = """
def example_function():
    return ...
    """
        module = ast.parse(code)
        assert ellipsis_in_ast_not_types(module) is True

    @unittest.skip
    def test_ellipsis_in_ast_without_ellipsis(self) -> None:
        """Test that ellipsis_in_ast does not detect an ellipsis when there is none."""
        code = """
def example_function():
    return 42
    """
        module = ast.parse(code)
        assert ellipsis_in_ast_not_types(module) is False

    @unittest.skip
    def test_ellipsis_in_ast_in_type_annotation(self) -> None:
        """Test that ellipsis_in_ast ignores ellipses in type annotations."""
        code = """
def example_function(param: tuple[int, ...]) -> None:
    pass
    """
        module = ast.parse(code)
        assert ellipsis_in_ast_not_types(module) is False

    @unittest.skip
    def test_ellipsis_in_ast_in_type_annotation_union(self) -> None:
        """Test that ellipsis_in_ast ignores ellipses in type annotations with unions."""
        code = """
def example_function(param: tuple[int, ...] | list[int]) -> None:
    pass
    """
        module = ast.parse(code)
        assert ellipsis_in_ast_not_types(module) is False

    @unittest.skip
    def test_ellipsis_in_ast(self) -> None:
        code = """def example_fn():
    return ..."""
        module = ast.parse(code)
        assert any_ellipsis_in_ast(module) is True
