from main import is_private_ip


def test_private_ip_detected():
    assert is_private_ip("192.168.1.5") is True
    assert is_private_ip("10.0.0.15") is True


def test_public_ip_detected():
    assert is_private_ip("185.220.101.5") is False
    assert is_private_ip("8.8.8.8") is False


def test_invalid_ip_treated_as_private():
    # Malformed input should not crash the app or trigger an external
    # API call — it defaults to "private" (safe fallback)
    assert is_private_ip("not-an-ip") is True
