a digital entity named phi that roams bsky phi.zzstoatzz.io
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

ruff format pickup for test_search_network.py

trailing reformat from a recent ruff format run; no behavior change.

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

+52 -25
+52 -25
tests/test_search_network.py
··· 55 55 56 56 def _semble_response(items): 57 57 """Wrap items in semble's {urls: [...], pagination: {...}} envelope.""" 58 - return {"urls": items, "pagination": {"currentPage": 1, "totalPages": 1, "totalCount": len(items), "hasMore": False, "limit": 10}} 58 + return { 59 + "urls": items, 60 + "pagination": { 61 + "currentPage": 1, 62 + "totalPages": 1, 63 + "totalCount": len(items), 64 + "hasMore": False, 65 + "limit": 10, 66 + }, 67 + } 59 68 60 69 61 70 class TestSearchNetworkFormatting: 62 71 async def test_formats_results_with_all_fields(self): 63 - resp = _mock_response(200, _semble_response([ 64 - { 65 - "url": "https://atproto.com", 66 - "metadata": { 67 - "title": "AT Protocol", 68 - "description": "Federated social networking protocol", 69 - }, 70 - "urlLibraryCount": 5, 71 - }, 72 - { 73 - "url": "https://docs.bsky.app", 74 - "metadata": { 75 - "title": "Bluesky Docs", 76 - "description": "Documentation for Bluesky", 77 - }, 78 - "urlLibraryCount": 3, 79 - }, 80 - ])) 72 + resp = _mock_response( 73 + 200, 74 + _semble_response( 75 + [ 76 + { 77 + "url": "https://atproto.com", 78 + "metadata": { 79 + "title": "AT Protocol", 80 + "description": "Federated social networking protocol", 81 + }, 82 + "urlLibraryCount": 5, 83 + }, 84 + { 85 + "url": "https://docs.bsky.app", 86 + "metadata": { 87 + "title": "Bluesky Docs", 88 + "description": "Documentation for Bluesky", 89 + }, 90 + "urlLibraryCount": 3, 91 + }, 92 + ] 93 + ), 94 + ) 81 95 with patch("httpx.AsyncClient.get", new_callable=AsyncMock, return_value=resp): 82 96 result = await _search_network("atproto") 83 97 assert "AT Protocol — https://atproto.com (5 saves)" in result ··· 85 99 assert "Bluesky Docs — https://docs.bsky.app (3 saves)" in result 86 100 87 101 async def test_formats_results_with_minimal_fields(self): 88 - resp = _mock_response(200, _semble_response([ 89 - {"url": "https://example.com/music", "metadata": {"title": "some note about music"}}, 90 - ])) 102 + resp = _mock_response( 103 + 200, 104 + _semble_response( 105 + [ 106 + { 107 + "url": "https://example.com/music", 108 + "metadata": {"title": "some note about music"}, 109 + }, 110 + ] 111 + ), 112 + ) 91 113 with patch("httpx.AsyncClient.get", new_callable=AsyncMock, return_value=resp): 92 114 result = await _search_network("music") 93 115 assert "some note about music" in result ··· 115 137 assert result.startswith("network search failed:") 116 138 117 139 async def test_untitled_fallback(self): 118 - resp = _mock_response(200, _semble_response([ 119 - {"url": "https://example.com", "metadata": {}}, 120 - ])) 140 + resp = _mock_response( 141 + 200, 142 + _semble_response( 143 + [ 144 + {"url": "https://example.com", "metadata": {}}, 145 + ] 146 + ), 147 + ) 121 148 with patch("httpx.AsyncClient.get", new_callable=AsyncMock, return_value=resp): 122 149 result = await _search_network("test") 123 150 assert "untitled — https://example.com" in result