From f35ddfcead37e015d5c84356fa18cb38f0e57c0c Mon Sep 17 00:00:00 2001 From: seonghobae <8172694+seonghobae@users.noreply.github.com> Date: Sun, 9 Aug 2026 09:33:26 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=AA=20[pr-review-autofix-context]=20Ad?= =?UTF-8?q?d=20tests=20for=20repo=5Fparts=20parsing=20function?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/test_pr_review_autofix_context.py | 27 +++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 tests/test_pr_review_autofix_context.py diff --git a/tests/test_pr_review_autofix_context.py b/tests/test_pr_review_autofix_context.py new file mode 100644 index 000000000..611790eee --- /dev/null +++ b/tests/test_pr_review_autofix_context.py @@ -0,0 +1,27 @@ +"""Tests for pr_review_autofix_context.py.""" + +import pytest +import sys +import os + +sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "scripts", "ci"))) +import pr_review_autofix_context +from pr_review_autofix_context import repo_parts + +def test_repo_parts_valid(): + """Test repo_parts with valid OWNER/NAME formats.""" + assert repo_parts("owner/name") == ("owner", "name") + assert repo_parts("octocat/Hello-World") == ("octocat", "Hello-World") + +def test_repo_parts_invalid(): + """Test repo_parts with invalid formats that should raise ValueError.""" + invalid_cases = [ + "ownername", # missing slash + "/name", # missing owner + "owner/", # missing name + "", # empty string + "/", # just slash + ] + for case in invalid_cases: + with pytest.raises(ValueError, match="repo must be OWNER/NAME, got"): + repo_parts(case)