From 7bb690dad0a6a1041a31615b4ea63b50fbcd3b11 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 4 Aug 2026 16:36:44 +0000 Subject: [PATCH] test: call DataTypes.from_content in GitHub hostname tests from_content lives on DataTypes, not the DataType enum. Co-authored-by: Rip&Tear --- lib/crewai-tools/tests/rag/test_data_types.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/crewai-tools/tests/rag/test_data_types.py b/lib/crewai-tools/tests/rag/test_data_types.py index 1812e1ea4..edb398801 100644 --- a/lib/crewai-tools/tests/rag/test_data_types.py +++ b/lib/crewai-tools/tests/rag/test_data_types.py @@ -1,32 +1,32 @@ -"""Tests for DataType content classification.""" +"""Tests for DataTypes content classification.""" -from crewai_tools.rag.data_types import DataType +from crewai_tools.rag.data_types import DataType, DataTypes -class TestDataTypeFromContentGitHub: +class TestDataTypesFromContentGitHub: """GitHub URL detection must use hostname matching, not substrings.""" def test_github_com_url(self) -> None: assert ( - DataType.from_content("https://github.com/crewai/crewai") + DataTypes.from_content("https://github.com/crewai/crewai") == DataType.GITHUB ) def test_github_subdomain_url(self) -> None: assert ( - DataType.from_content("https://gist.github.com/user/abc") + DataTypes.from_content("https://gist.github.com/user/abc") == DataType.GITHUB ) def test_spoofed_github_hostname_is_website(self) -> None: # Substring checks like `"github.com" in netloc` would misclassify this. assert ( - DataType.from_content("https://github.com.evil.example/crewai") + DataTypes.from_content("https://github.com.evil.example/crewai") == DataType.WEBSITE ) def test_github_in_path_is_not_github(self) -> None: assert ( - DataType.from_content("https://example.com/github.com/repo") + DataTypes.from_content("https://example.com/github.com/repo") == DataType.WEBSITE )