Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

test: drop redundant cases; fix gov docs

PhantomInTheWire6a9af566202d
diff --git a/apps/js-sdk/firecrawl/README.md b/apps/js-sdk/firecrawl/README.md
index 1bbd87430..2b9663246 100644
--- a/apps/js-sdk/firecrawl/README.md
+++ b/apps/js-sdk/firecrawl/README.md
@@ -242,8 +242,9 @@ Use `legalRegulatorySearch` to search the Legal and Regulatory Index: primary
law and regulatory material from US federal, state, and local government
sources, including statutes, regulations, codes, court opinions, and other
government publications. Results come back in the ordinary web-result shape.
-Generic `search(..., { categories: ['gov'] })` returns index results inside
-`.web`; like `developer`, it cannot be combined with other categories.
+Generic `search('food labeling requirements', { categories: ['gov'] })`
+returns index results inside `.web`; like `developer`, it cannot be combined
+with other categories.
```js
const law = await app.legalRegulatorySearch('food labeling requirements', {
diff --git a/apps/js-sdk/firecrawl/src/__tests__/unit/v2/legal-regulatory.test.ts b/apps/js-sdk/firecrawl/src/__tests__/unit/v2/legal-regulatory.test.ts
index 4ea77d18a..7407a5f6d 100644
--- a/apps/js-sdk/firecrawl/src/__tests__/unit/v2/legal-regulatory.test.ts
+++ b/apps/js-sdk/firecrawl/src/__tests__/unit/v2/legal-regulatory.test.ts
@@ -1,7 +1,5 @@
import { describe, expect, jest, test } from "@jest/globals";
import { FirecrawlClient } from "../../../v2/client";
-import { search } from "../../../v2/methods/search";
-import { SdkError } from "../../../v2/types";
const response = {
success: true,
@@ -65,44 +63,4 @@ describe("legalRegulatorySearch", () => {
clientWith(http).legalRegulatorySearch("zoning variance"),
).rejects.toThrow("Search failed");
});
-
- test("normalizes transport errors to SdkError", async () => {
- const http = {
- post: jest.fn(async () => {
- throw {
- isAxiosError: true,
- code: "ECONNABORTED",
- message: "request timed out",
- };
- }),
- } as any;
-
- await expect(
- clientWith(http).legalRegulatorySearch("network failure"),
- ).rejects.toBeInstanceOf(SdkError);
- });
-});
-
-describe("search gov category", () => {
- test("forwards the gov category and returns results inside web", async () => {
- const web = [{ ...response.data.web[0], category: "gov" }];
- const http = {
- post: jest.fn(async () => ({
- status: 200,
- data: { success: true, data: { web } },
- })),
- } as any;
-
- const result = await search(http, {
- query: "zoning variance",
- categories: [{ type: "gov" }],
- });
-
- expect(http.post).toHaveBeenCalledWith(
- "/v2/search",
- { query: "zoning variance", categories: [{ type: "gov" }] },
- {},
- );
- expect(result.web).toEqual(web);
- });
});
diff --git a/apps/python-sdk/README.md b/apps/python-sdk/README.md
index 21973c10e..517399473 100644
--- a/apps/python-sdk/README.md
+++ b/apps/python-sdk/README.md
@@ -264,8 +264,9 @@ Use `legal_regulatory_search` to search the Legal and Regulatory Index: primary
law and regulatory material from US federal, state, and local government
sources, including statutes, regulations, codes, court opinions, and other
government publications. Results come back in the ordinary web-result shape.
-Generic `search(categories=["gov"])` returns index results inside `.web`;
-like `developer`, it cannot be combined with other categories.
+Generic `search("food labeling requirements", categories=["gov"])` returns
+index results inside `.web`; like `developer`, it cannot be combined with other
+categories.
```python
law = firecrawl.legal_regulatory_search("food labeling requirements", k=5)
diff --git a/apps/python-sdk/firecrawl/__tests__/unit/v2/methods/test_legal_regulatory_search.py b/apps/python-sdk/firecrawl/__tests__/unit/v2/methods/test_legal_regulatory_search.py
index 507f0f6f8..4b8322f31 100644
--- a/apps/python-sdk/firecrawl/__tests__/unit/v2/methods/test_legal_regulatory_search.py
+++ b/apps/python-sdk/firecrawl/__tests__/unit/v2/methods/test_legal_regulatory_search.py
@@ -4,8 +4,6 @@ import pytest
from firecrawl.v2.client import FirecrawlClient
from firecrawl.v2.client_async import AsyncFirecrawlClient
-from firecrawl.v2.methods.search import search
-from firecrawl.v2.types import SearchRequest
from firecrawl.v2.utils.error_handler import FirecrawlError
@@ -87,26 +85,3 @@ def test_legal_regulatory_search_raises_on_unsuccessful_body():
with pytest.raises(FirecrawlError, match="Search failed"):
client.legal_regulatory_search("zoning variance")
-
-
-async def test_async_legal_regulatory_search_raises_on_unsuccessful_body():
- transport = Mock()
- transport.post = AsyncMock(return_value=_response(FAILED))
- client = AsyncFirecrawlClient.__new__(AsyncFirecrawlClient)
- client.async_http_client = transport
-
- with pytest.raises(FirecrawlError, match="Search failed"):
- await client.legal_regulatory_search("zoning variance")
-
-
-def test_search_gov_category_is_forwarded_and_parsed_inside_web():
- web = [{**RESPONSE["data"]["web"][0], "category": "gov"}]
- client = Mock()
- client.post.return_value = _response({"success": True, "data": {"web": web}})
-
- result = search(client, SearchRequest(query="zoning variance", categories=["gov"]))
-
- assert client.post.call_args.args[1]["categories"] == [{"type": "gov"}]
- assert result.web[0].category == "gov"
- assert not hasattr(result, "gov")
diff --git a/apps/python-sdk/firecrawl/v2/types.py b/apps/python-sdk/firecrawl/v2/types.py
index 676e2cfef..ffe87f296 100644
--- a/apps/python-sdk/firecrawl/v2/types.py
+++ b/apps/python-sdk/firecrawl/v2/types.py
@@ -622,8 +622,8 @@ SourceOption = Union[str, Source]
class Category(BaseModel):
"""Configuration for a search category.
- Categories narrow ordinary **web search**. They do not switch `search()` to
- a different index.
+ Most categories narrow ordinary **web search**; "developer" and "gov" switch
+ `search()` to their own index.
Supported categories:
- "github": Restrict web results to github.com (a `site:` filter)