repo_id
stringclasses
409 values
prefix
large_stringlengths
34
36.3k
target
large_stringlengths
1
498
assertion_type
stringclasses
31 values
difficulty
stringclasses
8 values
test_file
stringlengths
10
121
test_function
stringlengths
1
104
test_class
stringlengths
0
51
lineno
int32
2
11.3k
commit_idx
int32
taylorwilsdon/google_workspace_mcp
import pytest from unittest.mock import AsyncMock, Mock from gdocs.docs_helpers import ( build_paragraph_style, create_update_paragraph_style_request, ) from gdocs.managers.validation_manager import ValidationManager class TestBuildParagraphStyle: def test_no_params_returns_empty(self): style, fie...
{}
assert
collection
tests/gdocs/test_paragraph_style.py
test_no_params_returns_empty
TestBuildParagraphStyle
20
null
taylorwilsdon/google_workspace_mcp
import sys import os sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) from auth.scopes import ( BASE_SCOPES, CALENDAR_READONLY_SCOPE, CALENDAR_SCOPE, CONTACTS_READONLY_SCOPE, CONTACTS_SCOPE, DRIVE_FILE_SCOPE, DRIVE_READONLY_SCOPE, DRIVE_SCOPE, GMAI...
scopes
assert
variable
tests/test_scopes.py
test_docs_includes_drive_readonly
TestDocsScopes
45
null
taylorwilsdon/google_workspace_mcp
import sys import os sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) from auth.scopes import ( BASE_SCOPES, CALENDAR_READONLY_SCOPE, CALENDAR_SCOPE, CONTACTS_READONLY_SCOPE, CONTACTS_SCOPE, DRIVE_FILE_SCOPE, DRIVE_READONLY_SCOPE, DRIVE_SCOPE, GMAI...
with_permissions
assert
variable
tests/test_scopes.py
test_permissions_mode_overrides_read_only_and_full_maps
TestGranularPermissionsScopes
230
null
taylorwilsdon/google_workspace_mcp
import pytest from unittest.mock import AsyncMock, Mock from gdocs.docs_helpers import ( build_paragraph_style, create_update_paragraph_style_request, ) from gdocs.managers.validation_manager import ValidationManager class TestBuildParagraphStyle: def test_heading_zero_maps_to_normal_text(self): ...
"NORMAL_TEXT"
assert
string_literal
tests/gdocs/test_paragraph_style.py
test_heading_zero_maps_to_normal_text
TestBuildParagraphStyle
25
null
taylorwilsdon/google_workspace_mcp
import os import sys import pytest sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) import main def fake_resolve_tools_from_tier(tier, services): assert tier == "core" assert services ==
["gmail", "drive", "slides"]
assert
collection
tests/test_main_permissions_tier.py
fake_resolve_tools_from_tier
23
null
taylorwilsdon/google_workspace_mcp
import pytest from unittest.mock import AsyncMock, Mock from gdocs.docs_helpers import ( build_paragraph_style, create_update_paragraph_style_request, ) from gdocs.managers.validation_manager import ValidationManager class TestCreateUpdateParagraphStyleRequest: def test_produces_correct_api_structure(sel...
"namedStyleType"
assert
string_literal
tests/gdocs/test_paragraph_style.py
test_produces_correct_api_structure
TestCreateUpdateParagraphStyleRequest
60
null
taylorwilsdon/google_workspace_mcp
import pytest from unittest.mock import AsyncMock, Mock from gdocs.docs_helpers import ( build_paragraph_style, create_update_paragraph_style_request, ) from gdocs.managers.validation_manager import ValidationManager class TestBuildParagraphStyle: def test_line_spacing_scaled_to_percentage(self): ...
150.0
assert
numeric_literal
tests/gdocs/test_paragraph_style.py
test_line_spacing_scaled_to_percentage
TestBuildParagraphStyle
37
null
taylorwilsdon/google_workspace_mcp
import pytest from unittest.mock import AsyncMock, Mock from gdocs.docs_helpers import ( build_paragraph_style, create_update_paragraph_style_request, ) from gdocs.managers.validation_manager import ValidationManager class TestBuildParagraphStyle: def test_dimension_field_uses_pt_unit(self): styl...
{"magnitude": 36.0, "unit": "PT"}
assert
collection
tests/gdocs/test_paragraph_style.py
test_dimension_field_uses_pt_unit
TestBuildParagraphStyle
41
null
taylorwilsdon/google_workspace_mcp
import pytest from unittest.mock import Mock import sys import os sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))) from gsheets.sheets_tools import _format_sheet_range_impl def create_mock_service(): """Create a properly configured mock Google Sheets service.""" mock_serv...
"TOP"
assert
string_literal
tests/gsheets/test_format_sheet_range.py
test_format_vertical_alignment_top
157
null
taylorwilsdon/google_workspace_mcp
import sys import os sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))) from gcontacts.contacts_tools import ( _format_contact, _build_person_body, ) class TestBuildPersonBody: def test_build_empty_body(self): """Test building an empty person body.""" b...
{}
assert
collection
tests/gcontacts/test_contacts_tools.py
test_build_empty_body
TestBuildPersonBody
245
null
taylorwilsdon/google_workspace_mcp
import pytest from unittest.mock import Mock import sys import os sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))) from gsheets.sheets_tools import _format_sheet_range_impl def create_mock_service(): """Create a properly configured mock Google Sheets service.""" mock_serv...
"CLIP"
assert
string_literal
tests/gsheets/test_format_sheet_range.py
test_format_wrap_strategy_clip
66
null
taylorwilsdon/google_workspace_mcp
import os import socket import sys import httpx import pytest sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))) from gdrive import drive_tools @pytest.mark.asyncio async def test_fetch_url_with_pinned_ip_uses_pinned_target_and_host_header(monkeypatch): """Requests should targ...
200
assert
numeric_literal
tests/gdrive/test_ssrf_protections.py
test_fetch_url_with_pinned_ip_uses_pinned_target_and_host_header
119
null
taylorwilsdon/google_workspace_mcp
import pytest from unittest.mock import Mock, AsyncMock, patch import sys import os sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))) from gdrive.drive_helpers import build_drive_list_params from gdrive.drive_tools import list_drive_items, search_drive_files def _unwrap(tool): ...
q
assert
variable
tests/gdrive/test_drive_tools.py
test_search_file_type_structured_query_combined
796
null
taylorwilsdon/google_workspace_mcp
import pytest from starlette.requests import Request from starlette.responses import FileResponse, JSONResponse from core.server import serve_attachment def _build_request(file_id: str) -> Request: scope = { "type": "http", "asgi": {"version": "3.0"}, "http_version": "1.1", "method...
"abc123"
assert
string_literal
tests/core/test_attachment_route.py
test_serve_attachment_uses_path_param_file_id
50
null
taylorwilsdon/google_workspace_mcp
import os import sys from unittest.mock import AsyncMock, MagicMock, patch import pytest sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))) from gdrive.drive_tools import _create_drive_folder_impl as _raw_create_drive_folder def _make_service(created_response): """Build a mock...
result
assert
variable
tests/gdrive/test_create_drive_folder.py
test_create_folder_root_skips_resolve
50
null
taylorwilsdon/google_workspace_mcp
import os import sys import pytest sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) import main def test_permissions_and_tools_flags_are_rejected(monkeypatch, capsys): monkeypatch.setattr(main, "configure_safe_logging", lambda: None) monkeypatch.setattr( sys, ...
SystemExit)
pytest.raises
variable
tests/test_main_permissions_tier.py
test_permissions_and_tools_flags_are_rejected
55
null
taylorwilsdon/google_workspace_mcp
import sys import os sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) from auth.scopes import ( BASE_SCOPES, CALENDAR_READONLY_SCOPE, CALENDAR_SCOPE, CONTACTS_READONLY_SCOPE, CONTACTS_SCOPE, DRIVE_FILE_SCOPE, DRIVE_READONLY_SCOPE, DRIVE_SCOPE, GMAI...
len(set(scopes))
assert
func_call
tests/test_scopes.py
test_docs_sheets_returns_unique_scopes
TestCombinedScopes
83
null
taylorwilsdon/google_workspace_mcp
import pytest from unittest.mock import Mock import sys import os sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))) from gsheets.sheets_tools import _format_sheet_range_impl def create_mock_service(): """Create a properly configured mock Google Sheets service.""" mock_serv...
"RIGHT"
assert
string_literal
tests/gsheets/test_format_sheet_range.py
test_format_horizontal_alignment_right
139
null
taylorwilsdon/google_workspace_mcp
import base64 import pytest from unittest.mock import AsyncMock, Mock, patch import sys import os sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))) def _make_message(text="Hello", attachments=None, msg_name="spaces/S/messages/M"): """Build a minimal Chat API message dict for te...
result
assert
variable
tests/gchat/test_chat_tools.py
test_get_messages_shows_attachment_metadata
81
null
taylorwilsdon/google_workspace_mcp
import os import socket import sys import httpx import pytest sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))) from gdrive import drive_tools @pytest.mark.asyncio async def test_ssrf_safe_fetch_rejects_disallowed_redirect_scheme(monkeypatch): """Redirects to non-http(s) sche...
ValueError, match="Redirect to disallowed scheme")
pytest.raises
complex_expr
tests/gdrive/test_ssrf_protections.py
test_ssrf_safe_fetch_rejects_disallowed_redirect_scheme
164
null
taylorwilsdon/google_workspace_mcp
import os import sys import pytest sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) import main def test_permissions_and_tools_flags_are_rejected(monkeypatch, capsys): monkeypatch.setattr(main, "configure_safe_logging", lambda: None) monkeypatch.setattr( sys, ...
1
assert
numeric_literal
tests/test_main_permissions_tier.py
test_permissions_and_tools_flags_are_rejected
58
null
taylorwilsdon/google_workspace_mcp
import pytest from unittest.mock import Mock import sys import os sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))) from gappsscript.apps_script_tools import ( _list_script_projects_impl, _get_script_project_impl, _create_script_project_impl, _update_script_content_...
result
assert
variable
tests/gappsscript/test_apps_script_tools.py
test_list_script_projects
56
null
taylorwilsdon/google_workspace_mcp
import base64 import os import sys import pytest def test_urlsafe_b64decode_already_handles_crlf(): """Verify Python's urlsafe_b64decode ignores embedded CR/LF without manual stripping.""" original = b"Testdata" b64 = base64.urlsafe_b64encode(original).decode() assert base64.urlsafe_b64decode(b64 + ...
original
assert
variable
tests/gmail/test_attachment_fix.py
test_urlsafe_b64decode_already_handles_crlf
13
null
taylorwilsdon/google_workspace_mcp
import pytest from unittest.mock import AsyncMock, Mock from gdocs.docs_helpers import ( build_paragraph_style, create_update_paragraph_style_request, ) from gdocs.managers.validation_manager import ValidationManager class TestBatchManagerIntegration: def manager(self): from gdocs.managers.batch_...
1
assert
numeric_literal
tests/gdocs/test_paragraph_style.py
test_end_to_end_execute
TestBatchManagerIntegration
139
null
taylorwilsdon/google_workspace_mcp
import sys import os sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))) from gcontacts.contacts_tools import ( _format_contact, _build_person_body, ) class TestFormatContact: def test_format_basic_contact(self): """Test formatting a contact with basic fields.""...
result
assert
variable
tests/gcontacts/test_contacts_tools.py
test_format_basic_contact
TestFormatContact
32
null
taylorwilsdon/google_workspace_mcp
import pytest from unittest.mock import AsyncMock, Mock from gdocs.docs_helpers import ( build_paragraph_style, create_update_paragraph_style_request, ) from gdocs.managers.validation_manager import ValidationManager class TestBatchManagerIntegration: def manager(self): from gdocs.managers.batch_...
request
assert
variable
tests/gdocs/test_paragraph_style.py
test_build_request_and_description
TestBatchManagerIntegration
120
null
taylorwilsdon/google_workspace_mcp
import os import socket import sys import httpx import pytest sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))) from gdrive import drive_tools @pytest.mark.asyncio async def test_ssrf_safe_fetch_follows_relative_redirects(monkeypatch): """Relative redirects should be resolved...
["https://example.com/start", "https://example.com/next"]
assert
collection
tests/gdrive/test_ssrf_protections.py
test_ssrf_safe_fetch_follows_relative_redirects
148
null
taylorwilsdon/google_workspace_mcp
import os import sys import pytest sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) import main def test_resolve_permissions_mode_selection_with_tier_filters_services(monkeypatch): def fake_resolve_tools_from_tier(tier, services): assert tier == "core" assert se...
{"search_gmail_messages"}
assert
collection
tests/test_main_permissions_tier.py
test_resolve_permissions_mode_selection_with_tier_filters_services
32
null
taylorwilsdon/google_workspace_mcp
import pytest from unittest.mock import Mock import sys import os sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))) from gforms.forms_tools import _batch_update_form_impl @pytest.mark.asyncio async def test_batch_update_form_multiple_requests(): """Test batch update with multi...
result
assert
variable
tests/gforms/test_forms_tools.py
test_batch_update_form_multiple_requests
63
null
taylorwilsdon/google_workspace_mcp
import sys import os sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) from auth.scopes import ( BASE_SCOPES, CALENDAR_READONLY_SCOPE, CALENDAR_SCOPE, CONTACTS_READONLY_SCOPE, CONTACTS_SCOPE, DRIVE_FILE_SCOPE, DRIVE_READONLY_SCOPE, DRIVE_SCOPE, GMAI...
1
assert
numeric_literal
tests/test_scopes.py
test_docs_sheets_no_duplicate_drive_readonly
TestCombinedScopes
78
null
taylorwilsdon/google_workspace_mcp
import pytest from unittest.mock import AsyncMock, Mock from gdocs.docs_helpers import ( build_paragraph_style, create_update_paragraph_style_request, ) from gdocs.managers.validation_manager import ValidationManager class TestCreateUpdateParagraphStyleRequest: def test_produces_correct_api_structure(sel...
{"startIndex": 1, "endIndex": 10}
assert
collection
tests/gdocs/test_paragraph_style.py
test_produces_correct_api_structure
TestCreateUpdateParagraphStyleRequest
58
null
taylorwilsdon/google_workspace_mcp
import pytest from unittest.mock import Mock import sys import os sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))) from gsheets.sheets_tools import _format_sheet_range_impl def create_mock_service(): """Create a properly configured mock Google Sheets service.""" mock_serv...
16
assert
numeric_literal
tests/gsheets/test_format_sheet_range.py
test_format_combined_text_formatting
270
null
taylorwilsdon/google_workspace_mcp
import pytest from unittest.mock import Mock import sys import os sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))) from gsheets.sheets_tools import _format_sheet_range_impl def create_mock_service(): """Create a properly configured mock Google Sheets service.""" mock_serv...
True
assert
bool_literal
tests/gsheets/test_format_sheet_range.py
test_format_bold_true
211
null
taylorwilsdon/google_workspace_mcp
import sys import os sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))) from gcontacts.contacts_tools import ( _format_contact, _build_person_body, ) class TestBuildPersonBody: def test_build_body_job_title_only(self): """Test building a person body with only j...
"CEO"
assert
string_literal
tests/gcontacts/test_contacts_tools.py
test_build_body_job_title_only
TestBuildPersonBody
223
null
taylorwilsdon/google_workspace_mcp
import pytest from unittest.mock import Mock import sys import os sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))) from gsheets.sheets_tools import _format_sheet_range_impl def create_mock_service(): """Create a properly configured mock Google Sheets service.""" mock_serv...
"WRAP"
assert
string_literal
tests/gsheets/test_format_sheet_range.py
test_format_wrap_strategy_wrap
47
null
taylorwilsdon/google_workspace_mcp
import os import sys import pytest sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) import main def test_narrow_permissions_to_services_keeps_selected_order(): permissions = {"drive": "full", "gmail": "readonly", "calendar": "readonly"} narrowed = main.narrow_permissions_to...
{"gmail": "readonly", "drive": "full"}
assert
collection
tests/test_main_permissions_tier.py
test_narrow_permissions_to_services_keeps_selected_order
38
null
taylorwilsdon/google_workspace_mcp
import pytest from unittest.mock import AsyncMock, Mock from gdocs.docs_helpers import ( build_paragraph_style, create_update_paragraph_style_request, ) from gdocs.managers.validation_manager import ValidationManager class TestCreateUpdateParagraphStyleRequest: def test_returns_none_when_no_styles(self): ...
None
assert
none_literal
tests/gdocs/test_paragraph_style.py
test_returns_none_when_no_styles
TestCreateUpdateParagraphStyleRequest
53
null
taylorwilsdon/google_workspace_mcp
import pytest from unittest.mock import Mock, AsyncMock, patch import sys import os sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))) from gdrive.drive_helpers import build_drive_list_params from gdrive.drive_tools import list_drive_items, search_drive_files def _unwrap(tool): ...
result
assert
variable
tests/gdrive/test_drive_tools.py
test_search_drive_files_no_next_page_token_when_absent
113
null
taylorwilsdon/google_workspace_mcp
import os import sys import pytest sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) import main def fake_resolve_tools_from_tier(tier, services): assert tier ==
"core"
assert
string_literal
tests/test_main_permissions_tier.py
fake_resolve_tools_from_tier
22
null
taylorwilsdon/google_workspace_mcp
import sys import os sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))) from gcontacts.contacts_tools import ( _format_contact, _build_person_body, ) class TestBuildPersonBody: def test_build_basic_body(self): """Test building a basic person body.""" bo...
"Doe"
assert
string_literal
tests/gcontacts/test_contacts_tools.py
test_build_basic_body
TestBuildPersonBody
191
null
taylorwilsdon/google_workspace_mcp
import pytest from unittest.mock import Mock import sys import os sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))) from gsheets.sheets_tools import _format_sheet_range_impl def create_mock_service(): """Create a properly configured mock Google Sheets service.""" mock_serv...
"A1:C10"
assert
string_literal
tests/gsheets/test_format_sheet_range.py
test_format_wrap_strategy_wrap
42
null
taylorwilsdon/google_workspace_mcp
import sys import os import pytest sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) from auth.permissions import ( get_scopes_for_permission, parse_permissions_arg, SERVICE_PERMISSION_LEVELS, ) from auth.scopes import ( GMAIL_READONLY_SCOPE, GMAIL_LABELS_SCOPE, ...
set(SERVICE_PERMISSION_LEVELS.keys())
assert
func_call
tests/test_permissions.py
test_all_services_at_readonly
TestParsePermissionsArg
45
null
taylorwilsdon/google_workspace_mcp
import pytest from unittest.mock import Mock import sys import os sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))) from gsheets.sheets_tools import _format_sheet_range_impl def create_mock_service(): """Create a properly configured mock Google Sheets service.""" mock_serv...
"CENTER"
assert
string_literal
tests/gsheets/test_format_sheet_range.py
test_format_horizontal_alignment_center
103
null
taylorwilsdon/google_workspace_mcp
import os import sys import pytest sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) import main def test_resolve_permissions_mode_selection_without_tier(): services = ["gmail", "drive"] resolved_services, tier_tool_filter = main.resolve_permissions_mode_selection( s...
None
assert
none_literal
tests/test_main_permissions_tier.py
test_resolve_permissions_mode_selection_without_tier
17
null
taylorwilsdon/google_workspace_mcp
import pytest from unittest.mock import Mock import sys import os sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))) from gsheets.sheets_tools import _format_sheet_range_impl def create_mock_service(): """Create a properly configured mock Google Sheets service.""" mock_serv...
"LEFT"
assert
string_literal
tests/gsheets/test_format_sheet_range.py
test_format_horizontal_alignment_left
121
null
taylorwilsdon/google_workspace_mcp
import os import socket import sys import httpx import pytest sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))) from gdrive import drive_tools def test_resolve_and_validate_host_deduplicates_addresses(monkeypatch): """Duplicate DNS answers should be de-duplicated while preser...
[ "93.184.216.34", "2606:2800:220:1:248:1893:25c8:1946", ]
assert
collection
tests/gdrive/test_ssrf_protections.py
test_resolve_and_validate_host_deduplicates_addresses
79
null
taylorwilsdon/google_workspace_mcp
import sys import os import pytest sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) from auth.permissions import ( get_scopes_for_permission, parse_permissions_arg, SERVICE_PERMISSION_LEVELS, ) from auth.scopes import ( GMAIL_READONLY_SCOPE, GMAIL_LABELS_SCOPE, ...
ValueError, match="Unknown level")
pytest.raises
complex_expr
tests/test_permissions.py
test_unknown_level_raises
TestParsePermissionsArg
60
null
taylorwilsdon/google_workspace_mcp
import sys import os import pytest sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) from auth.permissions import ( get_scopes_for_permission, parse_permissions_arg, SERVICE_PERMISSION_LEVELS, ) from auth.scopes import ( GMAIL_READONLY_SCOPE, GMAIL_LABELS_SCOPE, ...
{"gmail": "readonly"}
assert
collection
tests/test_permissions.py
test_single_valid_entry
TestParsePermissionsArg
36
null
taylorwilsdon/google_workspace_mcp
import sys import os sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))) from gdocs.docs_markdown import ( convert_doc_to_markdown, format_comments_appendix, format_comments_inline, parse_drive_comments, ) SIMPLE_DOC = { "title": "Simple Test", "body": { ...
md
assert
variable
tests/gdocs/test_docs_markdown.py
test_plain_text
TestTextFormatting
227
null
taylorwilsdon/google_workspace_mcp
import pytest from starlette.requests import Request from starlette.responses import FileResponse, JSONResponse from core.server import serve_attachment def _build_request(file_id: str) -> Request: scope = { "type": "http", "asgi": {"version": "3.0"}, "http_version": "1.1", "method...
200
assert
numeric_literal
tests/core/test_attachment_route.py
test_serve_attachment_uses_path_param_file_id
52
null
shakedzy/dython
import pytest from dython.data_utils import one_hot_encode def test_more_than_one_dimension(): lst = [[0, 1], [2, 3]] with pytest.raises(
ValueError, match="must have only one dimension")
pytest.raises
complex_expr
tests/test_data_utils/test_one_hot_encode.py
test_more_than_one_dimension
24
null
shakedzy/dython
import pytest import numpy as np import pandas as pd from dython.nominal import associations, replot_last_associations def test_replot_last_associations(): """Test replot_last_associations function""" df = pd.DataFrame({ 'cat1': ['a', 'b', 'c', 'a'], 'num1': [1, 2, 3, 4] }) # First crea...
None
assert
none_literal
tests/test_nominal/test_associations_advanced.py
test_replot_last_associations
325
null
shakedzy/dython
import pytest import pandas as pd import numpy as np import matplotlib.pyplot as plt from matplotlib.axes._axes import Axes from dython.data_utils import split_hist class TestSplitHistAdvanced: def test_split_hist_with_figsize(self, iris_df): """Test split_hist with custom figsize""" result = spli...
6
assert
numeric_literal
tests/test_data_utils/test_split_hist_advanced.py
test_split_hist_with_figsize
TestSplitHistAdvanced
169
null
shakedzy/dython
import pytest import numpy as np import pandas as pd from dython.nominal import numerical_encoding def test_numerical_encoding_single_value_with_numeric(): """Test numerical encoding with single value column alongside numeric""" df = pd.DataFrame({ 'num': [1, 2, 3, 4], 'cat1': ['a', 'a', 'a', '...
result.columns
assert
complex_expr
tests/test_nominal/test_numerical_encoding.py
test_numerical_encoding_single_value_with_numeric
60
null
shakedzy/dython
import pytest import numpy as np import pandas as pd import matplotlib.pyplot as plt from dython._private import ( convert, remove_incomplete_samples, replace_nan_with_value, plot_or_not, set_is_jupyter, ) class TestRemoveIncompleteSamplesAdditional: def test_remove_incomplete_samples_no_nans(...
y)
assert_*
variable
tests/test_private_helpers_advanced.py
test_remove_incomplete_samples_no_nans
TestRemoveIncompleteSamplesAdditional
146
null
shakedzy/dython
import pytest import numpy as np from matplotlib.axes._axes import Axes from dython.model_utils import ks_abc def y_true(): return np.array([0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1]) def y_pred(): return np.array([0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]) def test_ks_abc_check_known_value(y_true, y_pre...
pytest.approx(0.4)
assert
func_call
tests/test_model_utils/test_ks_abc.py
test_ks_abc_check_known_value
48
null
shakedzy/dython
import pytest import numpy as np import pandas as pd import matplotlib.pyplot as plt from dython._private import ( convert, remove_incomplete_samples, replace_nan_with_value, plot_or_not, set_is_jupyter, ) class TestRemoveIncompleteSamplesAdditional: def test_remove_incomplete_samples_no_nans(...
x)
assert_*
variable
tests/test_private_helpers_advanced.py
test_remove_incomplete_samples_no_nans
TestRemoveIncompleteSamplesAdditional
145
null
shakedzy/dython
import pytest from hypothesis import given, strategies as st from dython.nominal import theils_u def test_theils_u_check(iris_df): x = iris_df["extra"] y = iris_df["target"] # Note: this measure is not symmetric assert theils_u(x, y) == pytest.approx(0.02907500150218738) assert theils_u(y, x) ==...
pytest.approx(0.0424761859049835)
assert
func_call
tests/test_nominal/test_theils_u.py
test_theils_u_check
13
null
shakedzy/dython
import pytest from hypothesis import given, strategies as st from dython.nominal import theils_u def two_categorical_lists(draw): n = draw(st.integers(min_value=2, max_value=30)) categorical_lists = st.lists(categories, min_size=n, max_size=n) return draw(categorical_lists), draw(categorical_lists) @giv...
u_xy
assert
variable
tests/test_nominal/test_theils_u.py
test_theils_u_value_range
38
null
shakedzy/dython
import pytest import numpy as np import matplotlib.pyplot as plt from dython.model_utils import metric_graph def test_metric_graph_with_ax(): """Test metric_graph with provided ax""" y_true = [0, 1, 0, 1] y_pred = [0.1, 0.9, 0.3, 0.8] fig, ax = plt.subplots() result = metric_graph(y_true, y_pr...
ax
assert
variable
tests/test_model_utils/test_metric_graph_advanced.py
test_metric_graph_with_ax
154
null
shakedzy/dython
import pytest import numpy as np from matplotlib.axes._axes import Axes from dython.model_utils import ks_abc def y_true(): return np.array([0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1]) def y_pred(): return np.array([0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]) def test_ks_abc_check_known_value(y_true, y_pre...
0.4)
pytest.approx
numeric_literal
tests/test_model_utils/test_ks_abc.py
test_ks_abc_check_known_value
48
null
shakedzy/dython
import pytest from hypothesis import given, strategies as st from dython.nominal import theils_u @given(x=st.lists(categories, min_size=2, max_size=30)) def test_theils_u_identity(x): assert theils_u(x, x) ==
pytest.approx(1.0)
assert
func_call
tests/test_nominal/test_theils_u.py
test_theils_u_identity
21
null
shakedzy/dython
import pytest import pandas as pd import scipy.stats as ss import numpy as np from psutil import cpu_count from datetime import datetime, timedelta from matplotlib.axes._axes import Axes from dython.nominal import associations, correlation_ratio MAX_CORE_COUNT = cpu_count(logical=False) def test_dimension_check(iris...
corr_shape[1]
assert
complex_expr
tests/test_nominal/test_associations_parallel.py
test_dimension_check
42
null
shakedzy/dython
import pytest import pandas as pd import numpy as np import scipy.stats as ss from sklearn import datasets from datetime import datetime, timedelta from matplotlib.axes._axes import Axes from dython.nominal import associations, correlation_ratio def test_compute_only_ax_is_none(iris_df): assoc = associations(iris...
None
assert
none_literal
tests/test_nominal/test_associations.py
test_compute_only_ax_is_none
69
null
shakedzy/dython
import pytest import numpy as np import pandas as pd from dython.nominal import associations, theils_u, correlation_ratio, cramers_v def test_correlation_ratio_zero_numerator(): """Test correlation ratio with zero numerator""" # All measurements are the same categories = ['a', 'b', 'c', 'a'] measuremen...
0.0
assert
numeric_literal
tests/test_nominal/test_inf_nan_handling.py
test_correlation_ratio_zero_numerator
42
null
shakedzy/dython
import pytest import numpy as np import matplotlib.pyplot as plt from dython.model_utils import metric_graph def test_metric_graph_binary_no_eopt(): """Test metric_graph binary without eopt""" y_true = [0, 1, 0, 1] y_pred = [0.1, 0.9, 0.3, 0.8] result = metric_graph(y_true, y_pred, metric='roc', e...
1
assert
numeric_literal
tests/test_model_utils/test_metric_graph_advanced.py
test_metric_graph_binary_no_eopt
116
null
shakedzy/dython
import pytest import numpy as np from dython.sampling import boltzmann_sampling, weighted_sampling def population(request): if request.param == "list": return [0.0, 1.0, 2.0, 3.0, 4.0] elif request.param == "array": return np.array([0.0, 1.0, 2.0, 3.0, 4.0]) @parametrize_sampling_funcs def tes...
np.float64
assert
complex_expr
tests/test_sampling.py
test_k_none
22
null
shakedzy/dython
import pytest from dython.data_utils import one_hot_encode def test_negative_input(): lst = [-1, -5, 0, 3] with pytest.raises(
ValueError, match="negative value")
pytest.raises
complex_expr
tests/test_data_utils/test_one_hot_encode.py
test_negative_input
17
null
shakedzy/dython
import pytest import numpy as np import pandas as pd from dython.nominal import associations, replot_last_associations def test_associations_with_numerical_columns(): """Test associations with numerical_columns parameter""" df = pd.DataFrame({ 'cat1': ['a', 'b', 'c', 'a'], 'cat2': ['x', 'y', 'x...
result
assert
variable
tests/test_nominal/test_associations_advanced.py
test_associations_with_numerical_columns
16
null
shakedzy/dython
import pytest import numpy as np import pandas as pd from dython.nominal import numerical_encoding def test_numerical_encoding_return_dict(): """Test numerical encoding with drop_fact_dict=False""" df = pd.DataFrame({ 'cat1': ['a', 'b', 'a', 'b'], 'num': [1, 2, 3, 4] }) result = numeric...
2
assert
numeric_literal
tests/test_nominal/test_numerical_encoding.py
test_numerical_encoding_return_dict
84
null
shakedzy/dython
import pytest import functools import numpy as np from hypothesis import given, strategies as st, assume, settings from dython.nominal import cramers_v approx = functools.partial(pytest.approx, abs=1e-6, rel=1e-6) def test_cramers_v_check(iris_df): x = iris_df["extra"] y = iris_df["target"] # Note: this...
0.14201914309546954)
pytest.approx
numeric_literal
tests/test_nominal/test_cramers_v.py
test_cramers_v_check
18
null
shakedzy/dython
import pytest import pandas as pd import scipy.stats as ss import numpy as np from psutil import cpu_count from datetime import datetime, timedelta from matplotlib.axes._axes import Axes from dython.nominal import associations, correlation_ratio MAX_CORE_COUNT = cpu_count(logical=False) def test_bad_nom_nom_assoc_pa...
ValueError, match="is not a supported")
pytest.raises
complex_expr
tests/test_nominal/test_associations_parallel.py
test_bad_nom_nom_assoc_parameter
65
null
shakedzy/dython
import pytest import numpy as np import pandas as pd from dython.data_utils import identify_columns_by_type, identify_columns_with_na class TestIdentifyColumnsWithNA: def test_identify_columns_with_na_all_na(self): """Test when all values in a column are NA""" df = pd.DataFrame({ 'col1...
4
assert
numeric_literal
tests/test_data_utils/test_identify_columns.py
test_identify_columns_with_na_all_na
TestIdentifyColumnsWithNA
173
null
shakedzy/dython
import pytest import functools import numpy as np from hypothesis import given, strategies as st, assume, settings from dython.nominal import cramers_v approx = functools.partial(pytest.approx, abs=1e-6, rel=1e-6) def two_categorical_lists(draw): n = draw(st.integers(min_value=2, max_value=30)) categorical_l...
1.0)
pytest.approx
numeric_literal
tests/test_nominal/test_cramers_v.py
test_cramers_v_value_range
46
null
shakedzy/dython
import pytest import numpy as np import pandas as pd import matplotlib.pyplot as plt from dython._private import ( convert, remove_incomplete_samples, replace_nan_with_value, plot_or_not, set_is_jupyter, ) class TestConvertAdditional: def test_convert_ndarray_to_list_2d(self): """Test ...
3
assert
numeric_literal
tests/test_private_helpers_advanced.py
test_convert_ndarray_to_list_2d
TestConvertAdditional
49
null
shakedzy/dython
import pytest import numpy as np import pandas as pd from dython.nominal import numerical_encoding def test_numerical_encoding_none(): """Test numerical encoding with None nominal columns""" df = pd.DataFrame({ 'num1': [1, 2, 3, 4], 'num2': [5, 6, 7, 8] }) result = numerical_encoding(df...
df)
assert_*
variable
tests/test_nominal/test_numerical_encoding.py
test_numerical_encoding_none
47
null
shakedzy/dython
import pytest from hypothesis import given, strategies as st from dython.nominal import theils_u @given(x=st.lists(categories, min_size=2, max_size=30)) def test_theils_u_identity(x): assert theils_u(x, x) == pytest.approx(
1.0)
pytest.approx
numeric_literal
tests/test_nominal/test_theils_u.py
test_theils_u_identity
21
null
shakedzy/dython
import pytest import numpy as np import pandas as pd from dython.nominal import associations, theils_u, correlation_ratio, cramers_v def test_correlation_ratio_precision_warning(): """Test correlation ratio with values that need precision rounding""" # Create data that produces eta slightly > 1 np.random.s...
result
assert
variable
tests/test_nominal/test_inf_nan_handling.py
test_correlation_ratio_precision_warning
53
null
shakedzy/dython
import pytest import numpy as np from matplotlib.axes._axes import Axes from dython.model_utils import metric_graph def y_true(): return np.array([0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1]) def y_pred(): return np.array([0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]) def test_metric_graph_bad_metric_paramete...
ValueError, match="Invalid metric")
pytest.raises
complex_expr
tests/test_model_utils/test_metric_graph.py
test_metric_graph_bad_metric_parameter
28
null
shakedzy/dython
import pytest import numpy as np import matplotlib.pyplot as plt from dython.model_utils import metric_graph def test_metric_graph_with_colors_string(): """Test metric_graph with colors as string""" y_true = [0, 1, 0, 1] y_pred = [0.1, 0.9, 0.3, 0.8] result = metric_graph(y_true, y_pred, metric='r...
result
assert
variable
tests/test_model_utils/test_metric_graph_advanced.py
test_metric_graph_with_colors_string
80
null
shakedzy/dython
import pytest import numpy as np import matplotlib.pyplot as plt from dython.model_utils import ks_abc def test_ks_abc_basic(): """Test basic ks_abc functionality""" y_true = [0, 1, 0, 1, 1, 0] y_pred = [0.1, 0.9, 0.3, 0.8, 0.7, 0.2] result = ks_abc(y_true, y_pred, plot=False) assert 'abc' in...
result
assert
variable
tests/test_model_utils/test_ks_abc_advanced.py
test_ks_abc_basic
13
null
shakedzy/dython
import pytest import pandas as pd import scipy.stats as ss import numpy as np from psutil import cpu_count from datetime import datetime, timedelta from matplotlib.axes._axes import Axes from dython.nominal import associations, correlation_ratio MAX_CORE_COUNT = cpu_count(logical=False) def test_return_type_check(ir...
assoc
assert
variable
tests/test_nominal/test_associations_parallel.py
test_return_type_check
20
null
shakedzy/dython
import pytest import numpy as np from matplotlib.axes._axes import Axes from dython.model_utils import ks_abc def y_true(): return np.array([0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1]) def y_pred(): return np.array([0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]) def test_ks_abc_check_known_value(y_true, y_pre...
1.0)
pytest.approx
numeric_literal
tests/test_model_utils/test_ks_abc.py
test_ks_abc_check_known_value
47
null
shakedzy/dython
import pytest import numpy as np import pandas as pd import matplotlib.pyplot as plt from dython._private import ( convert, remove_incomplete_samples, replace_nan_with_value, plot_or_not, set_is_jupyter, ) class TestReplaceNanWithValueAdditional: def test_replace_nan_with_value_none(self): ...
0
assert
numeric_literal
tests/test_private_helpers_advanced.py
test_replace_nan_with_value_none
TestReplaceNanWithValueAdditional
171
null
shakedzy/dython
import pytest import numpy as np import pandas as pd from sklearn import datasets from dython._private import ( convert, remove_incomplete_samples, replace_nan_with_value, ) pd.set_option("mode.chained_assignment", None) def iris_df(): iris = datasets.load_iris() df = pd.DataFrame(data=iris.data, ...
len(y_)
assert
func_call
tests/test_private_helpers.py
test_remove_incomplete_cases_one_nan_each
64
null
shakedzy/dython
import pytest import pandas as pd import numpy as np import matplotlib.pyplot as plt from matplotlib.axes._axes import Axes from dython.data_utils import split_hist class TestSplitHistAdvanced: def test_split_hist_all_parameters(self, iris_df): """Test split_hist with all parameters specified""" r...
"Complete Test"
assert
string_literal
tests/test_data_utils/test_split_hist_advanced.py
test_split_hist_all_parameters
TestSplitHistAdvanced
250
null
shakedzy/dython
import pytest import pandas as pd import numpy as np import scipy.stats as ss from sklearn import datasets from datetime import datetime, timedelta from matplotlib.axes._axes import Axes from dython.nominal import associations, correlation_ratio def test_dimension_check(iris_df): corr = associations(iris_df)["cor...
corr_shape[1]
assert
complex_expr
tests/test_nominal/test_associations.py
test_dimension_check
36
null
shakedzy/dython
import pytest import numpy as np import matplotlib.pyplot as plt from dython.model_utils import metric_graph def test_metric_graph_invalid_metric(): """Test metric_graph with invalid metric""" y_true = [0, 1, 0, 1] y_pred = [0.1, 0.9, 0.3, 0.8] with pytest.raises(
ValueError)
pytest.raises
variable
tests/test_model_utils/test_metric_graph_advanced.py
test_metric_graph_invalid_metric
12
null
shakedzy/dython
import pytest import numpy as np import pandas as pd import matplotlib.pyplot as plt from dython._private import ( convert, remove_incomplete_samples, replace_nan_with_value, plot_or_not, set_is_jupyter, ) class TestConvertAdditional: def test_convert_list_to_list_no_copy(self): """Tes...
lst
assert
variable
tests/test_private_helpers_advanced.py
test_convert_list_to_list_no_copy
TestConvertAdditional
56
null
shakedzy/dython
import pytest import numpy as np import pandas as pd import matplotlib.pyplot as plt from dython._private import ( convert, remove_incomplete_samples, replace_nan_with_value, plot_or_not, set_is_jupyter, ) class TestReplaceNanWithValueAdditional: def test_replace_nan_with_value_mixed_types(sel...
-1
assert
numeric_literal
tests/test_private_helpers_advanced.py
test_replace_nan_with_value_mixed_types
TestReplaceNanWithValueAdditional
191
null
shakedzy/dython
import pytest import numpy as np import pandas as pd from dython.data_utils import identify_columns_by_type, identify_columns_with_na class TestIdentifyColumnsByType: def test_identify_no_matching_columns(self): """Test when no columns match the requested type""" df = pd.DataFrame({ 'i...
[]
assert
collection
tests/test_data_utils/test_identify_columns.py
test_identify_no_matching_columns
TestIdentifyColumnsByType
89
null
shakedzy/dython
import pytest import numpy as np import pandas as pd from sklearn import datasets from dython._private import ( convert, remove_incomplete_samples, replace_nan_with_value, ) pd.set_option("mode.chained_assignment", None) def iris_df(): iris = datasets.load_iris() df = pd.DataFrame(data=iris.data, ...
ValueError, match="Unknown")
pytest.raises
complex_expr
tests/test_private_helpers.py
test_convert_bad_output
46
null
shakedzy/dython
import pytest import numpy as np import matplotlib.pyplot as plt from dython.model_utils import ks_abc def test_ks_abc_with_ax(): """Test ks_abc with provided ax""" y_true = [0, 1, 0, 1] y_pred = [0.1, 0.9, 0.3, 0.8] fig, ax = plt.subplots() result = ks_abc(y_true, y_pred, ax=ax, plot=False) ...
ax
assert
variable
tests/test_model_utils/test_ks_abc_advanced.py
test_ks_abc_with_ax
62
null
shakedzy/dython
import pytest import numpy as np from matplotlib.axes._axes import Axes from dython.model_utils import metric_graph def y_true(): return np.array([0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1]) def y_pred(): return np.array([0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]) def test_metric_graph_check_types(y_true,...
result
assert
variable
tests/test_model_utils/test_metric_graph.py
test_metric_graph_check_types
22
null
shakedzy/dython
import pytest from hypothesis import given, strategies as st from dython.nominal import theils_u def test_theils_u_check(iris_df): x = iris_df["extra"] y = iris_df["target"] # Note: this measure is not symmetric assert theils_u(x, y) ==
pytest.approx(0.02907500150218738)
assert
func_call
tests/test_nominal/test_theils_u.py
test_theils_u_check
12
null
shakedzy/dython
import pytest import pandas as pd import numpy as np import matplotlib.pyplot as plt from matplotlib.axes._axes import Axes from dython.data_utils import split_hist class TestSplitHistAdvanced: def test_split_hist_with_figsize(self, iris_df): """Test split_hist with custom figsize""" result = spli...
10
assert
numeric_literal
tests/test_data_utils/test_split_hist_advanced.py
test_split_hist_with_figsize
TestSplitHistAdvanced
168
null
shakedzy/dython
import pytest import numpy as np import pandas as pd from dython.nominal import numerical_encoding def test_numerical_encoding_basic(): """Test basic numerical encoding""" df = pd.DataFrame({ 'cat1': ['a', 'b', 'c', 'a'], 'cat2': ['x', 'y', 'x', 'y'], 'num': [1, 2, 3, 4] }) resu...
len(df.columns)
assert
func_call
tests/test_nominal/test_numerical_encoding.py
test_numerical_encoding_basic
16
null
shakedzy/dython
import pytest import pandas as pd import scipy.stats as ss import numpy as np from psutil import cpu_count from datetime import datetime, timedelta from matplotlib.axes._axes import Axes from dython.nominal import associations, correlation_ratio MAX_CORE_COUNT = cpu_count(logical=False) def test_compute_only_ax_is_n...
None
assert
none_literal
tests/test_nominal/test_associations_parallel.py
test_compute_only_ax_is_none
87
null
shakedzy/dython
import pytest from dython.data_utils import one_hot_encode def test_one_hot_encode_check(): lst = [0, 0, 2, 5] row = len(lst) col = max(lst) + 1 result = one_hot_encode(lst) assert result.shape ==
(row, col)
assert
collection
tests/test_data_utils/test_one_hot_encode.py
test_one_hot_encode_check
11
null
shakedzy/dython
import pytest import numpy as np from matplotlib.axes._axes import Axes from dython.model_utils import ks_abc def y_true(): return np.array([0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1]) def y_pred(): return np.array([0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]) def test_ks_abc_check_known_value(y_true, y_pre...
pytest.approx(1.0)
assert
func_call
tests/test_model_utils/test_ks_abc.py
test_ks_abc_check_known_value
47
null