From 12644bb362eceb2122332a166c84e3577ca19863 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Wed, 7 Oct 2026 03:54:04 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=AA=20Add=20missing=20error=20path=20t?= =?UTF-8?q?est=20for=20`resolve=5Fbind=5Ftarget`=20with=20unroutable=20IP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds a test to cover the branch in `resolve_bind_target` where an explicit error is returned if `iface_for_ip` returns `None` for a valid IP. This covers an otherwise untested error path, bringing branch coverage to 100% for this code block. Co-authored-by: Horizontal42 <75383519+Horizontal42@users.noreply.github.com> --- tests/test_iface.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/test_iface.py b/tests/test_iface.py index d3dbf57..22f1fe1 100644 --- a/tests/test_iface.py +++ b/tests/test_iface.py @@ -61,6 +61,16 @@ def test_resolve_bind_target_by_exact_name(): assert result.error is None +def test_resolve_bind_target_by_unmapped_ip_is_an_error(): + result = resolve_bind_target( + "10.255.255.255", + addrs(Ethernet=[(socket.AF_INET, "192.168.3.72")]), + up(Ethernet=True), + ) + assert result.error is not None + assert result.error == "no adapter has the address '10.255.255.255'" + + def test_resolve_bind_target_by_ip_finds_owning_adapter(): result = resolve_bind_target( "192.168.3.72",