Skip to content

Commit 1d3303a

Browse files
committed
✅ test: cover explicit empty file path inputs
1 parent 7c2f2e1 commit 1d3303a

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

tests/test_cli.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2880,6 +2880,24 @@ def test_pr_review_suggest_rejects_dual_stdin_inputs(
28802880
assert not any(call[:3] == ["gh", "api", "graphql"] for call in responder.calls)
28812881

28822882

2883+
def test_resolve_file_or_inline_text_treats_empty_file_path_as_provided(
2884+
monkeypatch: pytest.MonkeyPatch,
2885+
) -> None:
2886+
seen: list[str] = []
2887+
2888+
def fake_read_text_from_path_or_stdin(path: str) -> str:
2889+
seen.append(path)
2890+
return "from file"
2891+
2892+
monkeypatch.setattr(command_options, "read_text_from_path_or_stdin", fake_read_text_from_path_or_stdin)
2893+
args = argparse.Namespace(body="inline body", body_file="")
2894+
2895+
resolved = command_options.resolve_file_or_inline_text(args, text_attr="body", file_attr="body_file")
2896+
2897+
assert resolved == "from file"
2898+
assert seen == [""]
2899+
2900+
28832901
def _extract_form(cmd: list[str], key: str) -> str:
28842902
for idx, token in enumerate(cmd):
28852903
if token == "-f" and idx + 1 < len(cmd):

0 commit comments

Comments
 (0)