from skillls.checker import check_content_for_errors, ParenMismatchErrorKind import pytest def test_check_content_no_errors(): content = "(defun my_func (arg) (print arg))" # Should not raise any exception try: check_content_for_errors(content) except Exception as e: pytest.fail(f"Expected no error, but got {e}") def test_check_content_too_many_closed(): content = "())" with pytest.raises(ExceptionGroup) as eg: check_content_for_errors(content) # Check if the error type is correct exceptions = eg.value.exceptions assert any(isinstance(ex, Exception) and ex.kind == ParenMismatchErrorKind.TooManyClosed for ex in exceptions) def test_check_content_too_many_opened(): content = "((defun my_func (arg)" with pytest.raises(ExceptionGroup) as eg: check_content_for_errors(content) exceptions = eg.value.exceptions assert any(isinstance(ex, Exception) and ex.kind == ParenMismatchErrorKind.TooManyOpened for ex in exceptions) def test_check_content_empty(): check_content_for_errors("")