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 |
|---|---|---|---|---|---|---|---|---|---|
tableau/server-client-python | import os
from pathlib import Path
from io import BytesIO
from xml.etree import ElementTree as ET
from zipfile import ZipFile
import pytest
from tableauserverclient.filesys_helpers import get_file_object_size, get_file_type
TEST_ASSET_DIR = Path(__file__).parent / "assets"
def test_get_file_size_returns_correct_siz... | target_size | assert | variable | test/test_filesys_helpers.py | test_get_file_size_returns_correct_size | 22 | null | |
tableau/server-client-python | from io import BytesIO
import os
from pathlib import Path
import tempfile
from typing import Optional
import unittest
from zipfile import ZipFile
from defusedxml.ElementTree import fromstring
import pytest
import requests_mock
import tableauserverclient as TSC
from tableauserverclient import ConnectionItem
from table... | "user" | assert | string_literal | test/test_datasource.py | test_populate_permissions | 299 | null | |
tableau/server-client-python | import pytest
import tableauserverclient as TSC
def test_invalid_minimum_site_role():
group = TSC.GroupItem("grp")
with pytest.raises( | ValueError) | pytest.raises | variable | test/test_group_model.py | test_invalid_minimum_site_role | 8 | null | |
tableau/server-client-python | from pathlib import Path
import pytest
import requests_mock
import tableauserverclient as TSC
from tableauserverclient import GroupItem
TEST_ASSET_DIR = Path(__file__).parent / "assets"
GET_XML = TEST_ASSET_DIR / "project_get.xml"
GET_XML_ALL_FIELDS = TEST_ASSET_DIR / "project_get_all_fields.xml"
UPDATE_XML = TEST_... | ValueError) | pytest.raises | variable | test/test_project.py | test_delete_missing_id | 79 | null | |
tableau/server-client-python | from pathlib import Path
import pytest
import requests_mock
import tableauserverclient as TSC
from tableauserverclient import GroupItem
TEST_ASSET_DIR = Path(__file__).parent / "assets"
GET_XML = TEST_ASSET_DIR / "project_get.xml"
GET_XML_ALL_FIELDS = TEST_ASSET_DIR / "project_get_all_fields.xml"
UPDATE_XML = TEST_... | None | assert | none_literal | test/test_project.py | test_update_virtualconnection_default_permissions | 393 | null | |
tableau/server-client-python | from pathlib import Path
import requests_mock
import tableauserverclient as TSC
from tableauserverclient.datetime_helpers import format_datetime
import pytest
TEST_ASSET_DIR = Path(__file__).absolute().parent / "assets"
GET_XML = TEST_ASSET_DIR / "group_get.xml"
GET_XML_ALL_FIELDS = TEST_ASSET_DIR / "group_get_all_f... | 1 | assert | numeric_literal | test/test_group.py | test_get_all_fields | 339 | null | |
tableau/server-client-python | from pathlib import Path
from defusedxml.ElementTree import fromstring
import pytest
import requests_mock
import tableauserverclient as TSC
from tableauserverclient.datetime_helpers import parse_datetime
from tableauserverclient.models.linked_tasks_item import LinkedTaskItem, LinkedTaskStepItem, LinkedTaskFlowRunItem... | 3 | assert | numeric_literal | test/test_linked_tasks.py | test_parse_linked_task_flow_run | 37 | null | |
tableau/server-client-python | from pathlib import Path
import pytest
import requests_mock
import tableauserverclient as TSC
from tableauserverclient.server.endpoint.exceptions import NonXMLResponseError
TEST_ASSET_DIR = Path(__file__).parent / "assets"
SERVER_INFO_GET_XML = TEST_ASSET_DIR / "server_info_get.xml"
SERVER_INFO_25_XML = TEST_ASSET_... | "2.2" | assert | string_literal | test/test_server_info.py | test_server_info_use_highest_version_downgrades | 54 | null | |
tableau/server-client-python | from pathlib import Path
from defusedxml.ElementTree import fromstring
import requests_mock
import pytest
import tableauserverclient as TSC
TEST_ASSET_DIR = Path(__file__).parent / "assets"
GET_SERVER_EXT_SETTINGS = TEST_ASSET_DIR / "extensions_server_settings_true.xml"
GET_SERVER_EXT_SETTINGS_FALSE = TEST_ASSET_DI... | True | assert | bool_literal | test/test_extensions.py | test_get_server_extensions_settings | 34 | null | |
tableau/server-client-python | from io import BytesIO
import os
from pathlib import Path
import requests_mock
import tempfile
import pytest
import tableauserverclient as TSC
from tableauserverclient.datetime_helpers import format_datetime
TEST_ASSET_DIR = Path(__file__).parent / "assets"
GET_XML = TEST_ASSET_DIR / "flow_get.xml"
POPULATE_CONNECT... | all_flows[0].id | assert | complex_expr | test/test_flow.py | test_get | 64 | null | |
tableau/server-client-python | from io import BytesIO
import os
from pathlib import Path
import tempfile
from typing import Optional
import unittest
from zipfile import ZipFile
from defusedxml.ElementTree import fromstring
import pytest
import requests_mock
import tableauserverclient as TSC
from tableauserverclient import ConnectionItem
from table... | ds2.id | assert | complex_expr | test/test_datasource.py | test_populate_connections | 201 | null | |
tableau/server-client-python | from pathlib import Path
import pytest
import requests_mock
import tableauserverclient as TSC
TEST_ASSET_DIR = Path(__file__).parent / "assets"
CREATE_XML = TEST_ASSET_DIR / "subscription_create.xml"
GET_XML = TEST_ASSET_DIR / "subscription_get.xml"
GET_XML_BY_ID = TEST_ASSET_DIR / "subscription_get_by_id.xml"
def... | True | assert | bool_literal | test/test_subscription.py | test_get_subscriptions | 38 | null | |
tableau/server-client-python | from itertools import product
from pathlib import Path
from defusedxml import ElementTree as ET
import pytest
import requests_mock
import tableauserverclient as TSC
from tableauserverclient.server.request_factory import RequestFactory
from . import _utils
TEST_ASSET_DIR = Path(__file__).parent / "assets"
GET_XML =... | True | assert | bool_literal | test/test_site.py | test_get | 48 | null | |
tableau/server-client-python | import json
from pathlib import Path
import pytest
import requests_mock
import tableauserverclient as TSC
from tableauserverclient.server.endpoint.exceptions import GraphQLError
TEST_ASSET_DIR = Path(__file__).parent / "assets"
METADATA_QUERY_SUCCESS = TEST_ASSET_DIR / "metadata_query_success.json"
METADATA_QUERY_E... | actual | assert | variable | test/test_metadata.py | test_paged_metadata_query | 85 | null | |
tableau/server-client-python | from pathlib import Path
from defusedxml.ElementTree import fromstring
import pytest
import requests_mock
import tableauserverclient as TSC
from tableauserverclient.datetime_helpers import parse_datetime
from tableauserverclient.models.linked_tasks_item import LinkedTaskItem, LinkedTaskStepItem, LinkedTaskFlowRunItem... | None | assert | none_literal | test/test_linked_tasks.py | test_parse_linked_task | 67 | null | |
tableau/server-client-python | from pathlib import Path
import pytest
import requests_mock
import tableauserverclient as TSC
from tableauserverclient import GroupItem
TEST_ASSET_DIR = Path(__file__).parent / "assets"
GET_XML = TEST_ASSET_DIR / "project_get.xml"
GET_XML_ALL_FIELDS = TEST_ASSET_DIR / "project_get_all_fields.xml"
UPDATE_XML = TEST_... | new_project.id | assert | complex_expr | test/test_project.py | test_create | 187 | null | |
tableau/server-client-python | from pathlib import Path
from urllib.parse import parse_qs
import pytest
import requests_mock
import tableauserverclient as TSC
TEST_ASSET_DIR = Path(__file__).parent / "assets"
PAGINATION_XML = TEST_ASSET_DIR / "request_option_pagination.xml"
PAGE_NUMBER_XML = TEST_ASSET_DIR / "request_option_page_number.xml"
PAGE... | fields | assert | variable | test/test_request_option.py | test_queryset_field_order | 430 | null | |
tableau/server-client-python | from datetime import datetime
from pathlib import Path
import pytest
import requests_mock
import tableauserverclient as TSC
from tableauserverclient.datetime_helpers import utc
from tableauserverclient.server.endpoint.exceptions import JobFailedException
from ._utils import mocked_time
TEST_ASSET_DIR = Path(__file__... | job.type | assert | complex_expr | test/test_job.py | test_get | 50 | null | |
tableau/server-client-python | from pathlib import Path
import requests_mock
import tableauserverclient as TSC
from tableauserverclient.datetime_helpers import format_datetime
import pytest
TEST_ASSET_DIR = Path(__file__).absolute().parent / "assets"
GET_XML = TEST_ASSET_DIR / "group_get.xml"
GET_XML_ALL_FIELDS = TEST_ASSET_DIR / "group_get_all_f... | "試供品" | assert | string_literal | test/test_group.py | test_create_group | 253 | null | |
tableau/server-client-python | import logging
from unittest.mock import *
import io
import pytest
import tableauserverclient as TSC
def test_get_user_detail_standard() -> None:
test_line = "username, pword, fname, license, admin, pub, email"
test_user = TSC.UserItem.CSVImport.create_user_from_line(test_line)
assert test_user is not No... | "fname" | assert | string_literal | test/test_user_model.py | test_get_user_detail_standard | 94 | null | |
tableau/server-client-python | from pathlib import Path
from defusedxml.ElementTree import fromstring
import pytest
import requests_mock
import tableauserverclient as TSC
from tableauserverclient.datetime_helpers import parse_datetime
from tableauserverclient.models.linked_tasks_item import LinkedTaskItem, LinkedTaskStepItem, LinkedTaskFlowRunItem... | 1 | assert | numeric_literal | test/test_linked_tasks.py | test_parse_linked_task_flow_run | 36 | null | |
tableau/server-client-python | from pathlib import Path
from datetime import time
import pytest
import requests_mock
import tableauserverclient as TSC
from tableauserverclient.datetime_helpers import format_datetime
TEST_ASSET_DIR = Path(__file__).parent / "assets"
GET_XML = TEST_ASSET_DIR / "schedule_get.xml"
GET_BY_ID_XML = TEST_ASSET_DIR / "s... | flow.id | assert | complex_expr | test/test_schedule.py | test_get | 79 | null | |
tableau/server-client-python | from pathlib import Path
import sys
import pytest
import requests_mock
import tableauserverclient as TSC
from tableauserverclient.datetime_helpers import format_datetime
from tableauserverclient.server.endpoint.exceptions import FlowRunFailedException
from ._utils import mocked_time, server_response_error_factory
TE... | flow_run.status | assert | complex_expr | test/test_flowruns.py | test_get_by_id | 61 | null | |
tableau/server-client-python | from pathlib import Path
import pytest
import requests_mock
import tableauserverclient as TSC
TEST_ASSET_DIR = Path(__file__).parent / "assets"
SIGN_IN_XML = TEST_ASSET_DIR / "auth_sign_in.xml"
SIGN_IN_IMPERSONATE_XML = TEST_ASSET_DIR / "auth_sign_in_impersonate.xml"
SIGN_IN_ERROR_XML = TEST_ASSET_DIR / "auth_sign_... | server.user_id | assert | complex_expr | test/test_auth.py | test_sign_in | 33 | null | |
tableau/server-client-python | import logging
from unittest.mock import *
import io
import pytest
import tableauserverclient as TSC
def test_get_user_detail_standard() -> None:
test_line = "username, pword, fname, license, admin, pub, email"
test_user = TSC.UserItem.CSVImport.create_user_from_line(test_line)
assert test_user is not No... | "email" | assert | string_literal | test/test_user_model.py | test_get_user_detail_standard | 96 | null | |
tableau/server-client-python | import requests_mock
from pathlib import Path
import pytest
import tableauserverclient as TSC
from tableauserverclient.datetime_helpers import format_datetime
assets = Path(__file__).parent / "assets"
METRICS_GET = assets / "metrics_get.xml"
METRICS_GET_BY_ID = assets / "metrics_get_by_id.xml"
METRICS_UPDATE = asset... | 2 | assert | numeric_literal | test/test_metrics.py | test_metrics_get | 33 | null | |
tableau/server-client-python | from pathlib import Path
import pytest
import requests_mock
import tableauserverclient as TSC
TEST_ASSET_DIR = Path(__file__).parent / "assets"
GET_XML = TEST_ASSET_DIR / "data_alerts_get.xml"
GET_BY_ID_XML = TEST_ASSET_DIR / "data_alerts_get_by_id.xml"
ADD_USER_TO_ALERT = TEST_ASSET_DIR / "data_alerts_add_user.xml... | 1 | assert | numeric_literal | test/test_dataalert.py | test_get_by_id | 59 | null | |
tableau/server-client-python | import logging
from unittest.mock import *
import io
import pytest
import tableauserverclient as TSC
def test_evaluate_role() -> None:
for line in role_inputs:
actual = TSC.UserItem.CSVImport._evaluate_site_role(line[0], line[1], line[2])
assert actual == | line[3] | assert | complex_expr | test/test_user_model.py | test_evaluate_role | 80 | null | |
tableau/server-client-python | from pathlib import Path
import pytest
import requests_mock
import tableauserverclient as TSC
from tableauserverclient.models.reference_item import ResourceReference
TEST_ASSET_DIR = Path(__file__).parent / "assets"
GROUPSET_CREATE = TEST_ASSET_DIR / "groupsets_create.xml"
GROUPSETS_GET = TEST_ASSET_DIR / "groupsets... | "PUT" | assert | string_literal | test/test_groupsets.py | test_add_group | 119 | null | |
tableau/server-client-python | from pathlib import Path
import pytest
import requests_mock
import tableauserverclient as TSC
TEST_ASSET_DIR = Path(__file__).parent / "assets"
SIGN_IN_XML = TEST_ASSET_DIR / "auth_sign_in.xml"
SIGN_IN_IMPERSONATE_XML = TEST_ASSET_DIR / "auth_sign_in_impersonate.xml"
SIGN_IN_ERROR_XML = TEST_ASSET_DIR / "auth_sign_... | None | assert | none_literal | test/test_auth.py | test_sign_out | 107 | null | |
tableau/server-client-python | from pathlib import Path
from datetime import time
import pytest
import requests_mock
import tableauserverclient as TSC
from tableauserverclient.datetime_helpers import format_datetime
TEST_ASSET_DIR = Path(__file__).parent / "assets"
GET_XML = TEST_ASSET_DIR / "schedule_get.xml"
GET_BY_ID_XML = TEST_ASSET_DIR / "s... | system.id | assert | complex_expr | test/test_schedule.py | test_get | 88 | null | |
tableau/server-client-python | from pathlib import Path
import pytest
import requests_mock
import tableauserverclient as TSC
from tableauserverclient.server import RequestFactory
from tableauserverclient.models import WebhookItem
TEST_ASSET_DIR = Path(__file__).parent / "assets"
GET_XML = TEST_ASSET_DIR / "webhook_get.xml"
CREATE_XML = TEST_ASSE... | "url" | assert | string_literal | test/test_webhook.py | test_get | 38 | null | |
tableau/server-client-python | from io import BytesIO
import os
from pathlib import Path
import requests_mock
import tempfile
import pytest
import tableauserverclient as TSC
from tableauserverclient.datetime_helpers import format_datetime
TEST_ASSET_DIR = Path(__file__).parent / "assets"
GET_XML = TEST_ASSET_DIR / "flow_get.xml"
POPULATE_CONNECT... | 0 | assert | numeric_literal | test/test_flow.py | test_populate_connections | 113 | null | |
tableau/server-client-python | from pathlib import Path
import requests_mock
import pytest
import tableauserverclient as TSC
from tableauserverclient.datetime_helpers import format_datetime
TEST_ASSET_DIR = Path(__file__).parent / "assets"
GET_BY_ID_ACCELERATION_STATUS_XML = TEST_ASSET_DIR / "workbook_get_by_id_acceleration_status.xml"
POPULATE_... | views_list[1].id | assert | complex_expr | test/test_view_acceleration.py | test_update_views_acceleration | 112 | null | |
tableau/server-client-python | import pytest
import tableauserverclient as TSC
def test_parent_id():
project = TSC.ProjectItem("proj")
project.parent_id = "foo"
assert project.parent_id == | "foo" | assert | string_literal | test/test_project_model.py | test_parent_id | 22 | null | |
tableau/server-client-python | from datetime import datetime
from pathlib import Path
import pytest
import requests_mock
import tableauserverclient as TSC
from tableauserverclient.datetime_helpers import utc
from tableauserverclient.server.endpoint.exceptions import JobFailedException
from ._utils import mocked_time
TEST_ASSET_DIR = Path(__file__... | job.updated_at | assert | complex_expr | test/test_job.py | test_get_by_id | 65 | null | |
tableau/server-client-python | from pathlib import Path
import pytest
import requests_mock
import tableauserverclient as TSC
from tableauserverclient import GroupItem
TEST_ASSET_DIR = Path(__file__).parent / "assets"
GET_XML = TEST_ASSET_DIR / "project_get.xml"
GET_XML_ALL_FIELDS = TEST_ASSET_DIR / "project_get_all_fields.xml"
UPDATE_XML = TEST_... | project.name | assert | complex_expr | test/test_project.py | test_get_by_id | 89 | null | |
tableau/server-client-python | from pathlib import Path
import pytest
import requests_mock
import tableauserverclient as TSC
TEST_ASSET_DIR = Path(__file__).parent / "assets"
GET_XML = TEST_ASSET_DIR / "database_get.xml"
POPULATE_PERMISSIONS_XML = TEST_ASSET_DIR / "database_populate_permissions.xml"
UPDATE_XML = TEST_ASSET_DIR / "database_update... | single_database.id | assert | complex_expr | test/test_database.py | test_update | 56 | null | |
tableau/server-client-python | from io import BytesIO
import os
from pathlib import Path
import requests_mock
import tempfile
import pytest
import tableauserverclient as TSC
from tableauserverclient.datetime_helpers import format_datetime
TEST_ASSET_DIR = Path(__file__).parent / "assets"
GET_XML = TEST_ASSET_DIR / "flow_get.xml"
POPULATE_CONNECT... | None | assert | none_literal | test/test_flow.py | test_populate_connections | 112 | null | |
tableau/server-client-python | import json
from pathlib import Path
import pytest
import requests_mock
import tableauserverclient as TSC
from tableauserverclient.datetime_helpers import parse_datetime
from tableauserverclient.models.virtual_connection_item import VirtualConnectionItem
ASSET_DIR = Path(__file__).parent / "assets"
VIRTUAL_CONNECTI... | "2" | assert | string_literal | test/test_virtual_connection.py | test_virtual_connection_get_revisions | 163 | null | |
tableau/server-client-python | import tableauserverclient as TSC
import pytest
@pytest.mark.parametrize("conn_type", ["hyper", "teradata", "snowflake"])
def test_ignore_query_tag(conn_type: str) -> None:
conn = TSC.ConnectionItem()
conn._connection_type = conn_type
conn.query_tagging = True
assert conn.query_tagging is | None | assert | none_literal | test/test_connection_.py | test_ignore_query_tag | 25 | null | |
tableau/server-client-python | import csv
import io
from pathlib import Path
import re
from unittest.mock import patch
from pathlib import Path
from defusedxml import ElementTree as ET
import pytest
import requests_mock
import tableauserverclient as TSC
from tableauserverclient.datetime_helpers import format_datetime, parse_datetime
from tableause... | "POST" | assert | string_literal | test/test_user.py | test_bulk_add | 444 | null | |
tableau/server-client-python | import os
from pathlib import Path
from io import BytesIO
from xml.etree import ElementTree as ET
from zipfile import ZipFile
import pytest
from tableauserverclient.filesys_helpers import get_file_object_size, get_file_type
TEST_ASSET_DIR = Path(__file__).parent / "assets"
def test_get_file_type_handles_unknown_fil... | ValueError) | pytest.raises | variable | test/test_filesys_helpers.py | test_get_file_type_handles_unknown_file_type | 112 | null | |
tableau/server-client-python | import csv
import io
from pathlib import Path
import re
from unittest.mock import patch
from pathlib import Path
from defusedxml import ElementTree as ET
import pytest
import requests_mock
import tableauserverclient as TSC
from tableauserverclient.datetime_helpers import format_datetime, parse_datetime
from tableause... | [] | assert | collection | test/test_user.py | test_get_usernames_from_file | 288 | null | |
tableau/server-client-python | from pathlib import Path
import requests_mock
import tableauserverclient as TSC
from tableauserverclient.datetime_helpers import format_datetime
import pytest
TEST_ASSET_DIR = Path(__file__).absolute().parent / "assets"
GET_XML = TEST_ASSET_DIR / "group_get.xml"
GET_XML_ALL_FIELDS = TEST_ASSET_DIR / "group_get_all_f... | group.id | assert | complex_expr | test/test_group.py | test_update | 290 | null | |
tableau/server-client-python | import requests_mock
from pathlib import Path
import pytest
import tableauserverclient as TSC
assets = Path(__file__).parent / "assets"
OIDC_GET = assets / "oidc_get.xml"
OIDC_GET_BY_ID = assets / "oidc_get_by_id.xml"
OIDC_UPDATE = assets / "oidc_update.xml"
OIDC_CREATE = assets / "oidc_create.xml"
def server():
... | luid | assert | variable | test/test_oidc.py | test_oidc_delete | 69 | null | |
tableau/server-client-python | from datetime import time
from pathlib import Path
import pytest
import requests_mock
import tableauserverclient as TSC
from tableauserverclient.datetime_helpers import parse_datetime
from tableauserverclient.models.task_item import TaskItem
TEST_ASSET_DIR = Path(__file__).parent / "assets"
GET_XML_NO_WORKBOOK = TE... | task.target.type | assert | complex_expr | test/test_task.py | test_get_tasks_with_workbook | 60 | null | |
tableau/server-client-python | import os
import re
import requests_mock
import tempfile
from defusedxml.ElementTree import fromstring
from io import BytesIO
from pathlib import Path
import pytest
import tableauserverclient as TSC
from tableauserverclient.datetime_helpers import format_datetime, parse_datetime
from tableauserverclient.models import... | "group" | assert | string_literal | test/test_workbook.py | test_add_permissions | 438 | null | |
tableau/server-client-python | from pathlib import Path
import pytest
import requests_mock
import tableauserverclient as TSC
from tableauserverclient import UserItem, GroupItem, PermissionsRule
from tableauserverclient.datetime_helpers import format_datetime, parse_datetime
from tableauserverclient.server.endpoint.exceptions import UnsupportedAttr... | csv_file | assert | variable | test/test_view.py | test_populate_csv | 270 | null | |
tableau/server-client-python | from io import BytesIO
import os
from pathlib import Path
import tempfile
from typing import Optional
import unittest
from zipfile import ZipFile
from defusedxml.ElementTree import fromstring
import pytest
import requests_mock
import tableauserverclient as TSC
from tableauserverclient import ConnectionItem
from table... | None | assert | none_literal | test/test_datasource.py | test_populate_connections | 192 | null | |
tableau/server-client-python | import xml.etree.ElementTree as ET
from unittest.mock import Mock
import pytest
from tableauserverclient.server.request_factory import TaskRequest
def task_request() -> TaskRequest:
return TaskRequest()
def xml_request() -> ET.Element:
return ET.Element("tsRequest")
def test_refresh_req_default(task_reques... | ET.tostring(xml_request) | assert | func_call | test/request_factory/test_task_requests.py | test_refresh_req_default | 21 | null | |
tableau/server-client-python | import contextlib
import os
from pathlib import Path
import xml.etree.ElementTree as ET
import pytest
import requests_mock
import tableauserverclient as TSC
from tableauserverclient.config import config
TEST_ASSET_DIR = Path(__file__).parent / "assets"
GET_VIEW_XML = TEST_ASSET_DIR / "view_get.xml"
GET_XML_PAGE1 = ... | 1 | assert | numeric_literal | test/test_pager.py | test_pager_with_options | 100 | null | |
tableau/server-client-python | from pathlib import Path
from datetime import time
import pytest
import requests_mock
import tableauserverclient as TSC
from tableauserverclient.datetime_helpers import format_datetime
TEST_ASSET_DIR = Path(__file__).parent / "assets"
GET_XML = TEST_ASSET_DIR / "schedule_get.xml"
GET_BY_ID_XML = TEST_ASSET_DIR / "s... | 3 | assert | numeric_literal | test/test_schedule.py | test_batch_update_state_items | 456 | null | |
tableau/server-client-python | from pathlib import Path
import pytest
import requests_mock
import tableauserverclient as TSC
from tableauserverclient.server.endpoint.exceptions import NonXMLResponseError
TEST_ASSET_DIR = Path(__file__).parent / "assets"
SERVER_INFO_GET_XML = TEST_ASSET_DIR / "server_info_get.xml"
SERVER_INFO_25_XML = TEST_ASSET_... | "3.10" | assert | string_literal | test/test_server_info.py | test_server_info_use_highest_version_upgrades | 65 | null | |
tableau/server-client-python | from pathlib import Path
import pytest
import requests_mock
import tableauserverclient as TSC
from tableauserverclient.datetime_helpers import parse_datetime
TEST_ASSET_DIR = Path(__file__).parent / "assets"
GET_FAVORITES_XML = TEST_ASSET_DIR / "favorites_get.xml"
ADD_FAVORITE_WORKBOOK_XML = TEST_ASSET_DIR / "favor... | 1 | assert | numeric_literal | test/test_favorites.py | test_get | 42 | null | |
tableau/server-client-python | from pathlib import Path
import pytest
import requests_mock
import tableauserverclient as TSC
from tableauserverclient import GroupItem
TEST_ASSET_DIR = Path(__file__).parent / "assets"
GET_XML = TEST_ASSET_DIR / "project_get.xml"
GET_XML_ALL_FIELDS = TEST_ASSET_DIR / "project_get_all_fields.xml"
UPDATE_XML = TEST_... | rule.grantee.id | assert | complex_expr | test/test_project.py | test_populate_virtualconnection_default_permissions | 359 | null | |
tableau/server-client-python | from io import BytesIO
import os
from pathlib import Path
import requests_mock
import tempfile
import pytest
import tableauserverclient as TSC
from tableauserverclient.datetime_helpers import format_datetime
TEST_ASSET_DIR = Path(__file__).parent / "assets"
GET_XML = TEST_ASSET_DIR / "flow_get.xml"
POPULATE_CONNECT... | new_flow.id | assert | complex_expr | test/test_flow.py | test_publish | 169 | null | |
tableau/server-client-python | from pathlib import Path
import pytest
import requests_mock
import tableauserverclient as TSC
from tableauserverclient.models.reference_item import ResourceReference
TEST_ASSET_DIR = Path(__file__).parent / "assets"
GROUPSET_CREATE = TEST_ASSET_DIR / "groupsets_create.xml"
GROUPSETS_GET = TEST_ASSET_DIR / "groupsets... | 1 | assert | numeric_literal | test/test_groupsets.py | test_get | 38 | null | |
tableau/server-client-python | from pathlib import Path
import requests_mock
import pytest
import tableauserverclient as TSC
TEST_ASSET_DIR = Path(__file__).parent / "assets"
UPDATE_DFP_ALWAYS_LIVE_XML = TEST_ASSET_DIR / "workbook_update_data_freshness_policy.xml"
UPDATE_DFP_SITE_DEFAULT_XML = TEST_ASSET_DIR / "workbook_update_data_freshness_pol... | single_workbook.id | assert | complex_expr | test/test_data_freshness_policy.py | test_update_DFP_always_live | 39 | null | |
PyVRP/PyVRP | import numpy as np
import pytest
from numpy.testing import assert_, assert_equal
from pyvrp import (
Client,
CostEvaluator,
Depot,
ProblemData,
RandomNumberGenerator,
Solution,
VehicleType,
)
from pyvrp import Route as SolRoute
from pyvrp.search import (
Exchange10,
Exchange11,
... | sol) | assert_* | variable | tests/search/test_Exchange.py | test_cannot_exchange_when_parts_overlap_with_depot | 120 | null | |
PyVRP/PyVRP | import pickle
import numpy as np
import pytest
from numpy.random import default_rng
from numpy.testing import assert_, assert_equal, assert_raises
from pyvrp import Client, ClientGroup, Depot, ProblemData, VehicleType
_INT_MAX = np.iinfo(np.int64).max
_MAX_SIZE = np.iinfo(np.uint64).max
@pytest.mark.parametrize(
... | y) | assert_* | variable | tests/test_ProblemData.py | test_client_constructor_initialises_data_fields_correctly | 76 | null | |
PyVRP/PyVRP | from numpy.testing import assert_, assert_equal, assert_raises
from pyvrp import minimise_fleet
from pyvrp.stop import MaxIterations
from tests.helpers import read
def test_rc208(rc208):
"""
Tests that the fleet minimisation procedure significantly reduces the
number of vehicles in the RC208 instance.
... | 25) | assert_* | numeric_literal | tests/test_minimise_fleet.py | test_rc208 | 59 | null | |
PyVRP/PyVRP | import math
import pickle
import pytest
from numpy.testing import assert_, assert_allclose, assert_equal, assert_raises
from pyvrp import CostEvaluator, RandomNumberGenerator, Solution
from pyvrp.Result import Result
from pyvrp.Statistics import Statistics
@pytest.mark.parametrize(
("num_iterations", "runtime"),... | ValueError) | assert_* | variable | tests/test_Result.py | test_init_raises_invalid_arguments | 47 | null | |
PyVRP/PyVRP | import pickle
from numpy.testing import assert_, assert_equal, assert_raises
from pytest import mark
from pyvrp._pyvrp import DynamicBitset
def test_get_set_raises_out_of_bounds():
"""
Tests that setting and retrieving out of bounds raises an IndexError.
"""
bitset = DynamicBitset(128)
with ass... | IndexError) | assert_* | variable | tests/test_DynamicBitset.py | test_get_set_raises_out_of_bounds | 91 | null | |
PyVRP/PyVRP | import numpy as np
import pytest
from numpy.testing import assert_, assert_equal, assert_raises
from pyvrp import (
Client,
ClientGroup,
Depot,
Model,
PenaltyParams,
Profile,
SolveParams,
VehicleType,
)
from pyvrp.constants import MAX_VALUE
from pyvrp.exceptions import ScalingWarning
fr... | 5) | assert_* | numeric_literal | tests/test_Model.py | test_add_client_attributes | 108 | null | |
PyVRP/PyVRP | from numpy.testing import assert_, assert_allclose, assert_equal, assert_raises
import pyvrp
from pyvrp import CostEvaluator, RandomNumberGenerator
from pyvrp.search import (
PerturbationManager,
PerturbationParams,
compute_neighbours,
)
from pyvrp.search._search import SearchSpace, Solution
def test_pert... | 0) | assert_* | numeric_literal | tests/search/test_PerturbationManager.py | test_perturb_removes_clients | 114 | null | |
PyVRP/PyVRP | import numpy as np
import pytest
from numpy.testing import assert_, assert_equal
from pyvrp._pyvrp import LoadSegment
_INT_MAX = np.iinfo(np.int64).max
def test_excess_load_capacity():
"""
Tests that excess load is correctly evaluated and merged.
"""
before = LoadSegment(5, 5, 5, 30)
after = Load... | 35) | assert_* | numeric_literal | tests/test_LoadSegment.py | test_excess_load_capacity | 74 | null | |
PyVRP/PyVRP | import numpy as np
from numpy.testing import assert_, assert_allclose, assert_equal
from pytest import mark
from pyvrp import RandomNumberGenerator
@mark.parametrize("state", [[1, 2, 3, 4], [10, 14, 274, 83]])
def test_rng_has_given_state(state: list[int]):
"""
Tests that setting the RNG with a given state, a... | state) | assert_* | variable | tests/test_RandomNumberGenerator.py | test_rng_has_given_state | 67 | null | |
PyVRP/PyVRP | from numpy.testing import assert_, assert_equal, assert_raises
from pyvrp import PiecewiseLinearFunction
def test_call():
"""
Tests calling the piecewise linear function on various segments.
"""
fn = PiecewiseLinearFunction([5, 10, 20], [(1, 2), (11, 3), (26, 4)])
# 1st segment, defined for value... | 1 + 2 * 4) | assert_* | complex_expr | tests/test_PiecewiseLinearFunction.py | test_call | 15 | null | |
PyVRP/PyVRP | import numpy as np
import pytest
from numpy.testing import assert_, assert_equal
from pyvrp import (
Client,
CostEvaluator,
Depot,
ProblemData,
RandomNumberGenerator,
Solution,
VehicleType,
)
from pyvrp import Route as SolRoute
from pyvrp.search import (
Exchange10,
Exchange11,
... | cost) | assert_* | variable | tests/search/test_Exchange.py | test_exchange_with_duration_constraint | 385 | null | |
PyVRP/PyVRP | import numpy as np
import pytest
from numpy.testing import assert_, assert_equal
from pyvrp import (
Client,
CostEvaluator,
Depot,
ProblemData,
RandomNumberGenerator,
Solution,
VehicleType,
)
from pyvrp import Route as SolRoute
from pyvrp.search import (
Exchange10,
Exchange11,
... | [10]) | assert_* | collection | tests/search/test_Exchange.py | test_within_route_simultaneous_pickup_and_delivery | 411 | null | |
PyVRP/PyVRP | from numpy.testing import assert_, assert_equal
from pyvrp import CostEvaluator, Depot
from pyvrp.search import RemoveAdjacentDepot
from pyvrp.search._search import Node
from tests.helpers import make_search_route
def test_remove_reload_depots_service_duration(ok_small_multiple_trips):
"""
Tests that removing... | (-90, True)) | assert_* | collection | tests/search/test_RemoveAdjacentDepot.py | test_remove_reload_depots_service_duration | 117 | null | |
PyVRP/PyVRP | import pytest
from numpy.testing import assert_, assert_equal, assert_raises
from pyvrp import Route, Trip
def test_trip_iter_and_getitem(ok_small):
"""
Tests that the trip is iterable and may be indexed.
"""
trip = Trip(ok_small, [1, 2], 0, 0, 0)
# Regular indexing gets the client visits.
as... | 2) | assert_* | numeric_literal | tests/test_Trip.py | test_trip_iter_and_getitem | 124 | null | |
PyVRP/PyVRP | import numpy as np
from numpy.testing import assert_, assert_allclose, assert_equal
from pyvrp.IteratedLocalSearch import IteratedLocalSearchParams
from pyvrp.PenaltyManager import PenaltyParams
from pyvrp.search import (
OPERATORS,
Exchange10,
NeighbourhoodParams,
PerturbationParams,
SwapTails,
)
... | bks) | assert_* | variable | tests/test_solve.py | test_solve_initial_solution | 81 | null | |
PyVRP/PyVRP | import numpy as np
from numpy.testing import assert_, assert_allclose, assert_equal
from pyvrp.IteratedLocalSearch import IteratedLocalSearchParams
from pyvrp.PenaltyManager import PenaltyParams
from pyvrp.search import (
OPERATORS,
Exchange10,
NeighbourhoodParams,
PerturbationParams,
SwapTails,
)
... | OPERATORS) | assert_* | variable | tests/test_solve.py | test_default_values | 27 | null | |
PyVRP/PyVRP | from numpy.testing import assert_, assert_equal, assert_raises
from pyvrp import (
CostEvaluator,
RandomNumberGenerator,
Result,
Solution,
Statistics,
)
from pyvrp.ProgressPrinter import ProgressPrinter
def test_iteration(ok_small, caplog):
"""
Tests that calling iteration prints a line ab... | 1) | assert_* | numeric_literal | tests/test_ProgressPrinter.py | test_iteration | 95 | null | |
PyVRP/PyVRP | import numpy as np
import pytest
from numpy.testing import assert_, assert_equal
from pyvrp import Client, CostEvaluator, Depot, ProblemData, VehicleType
from pyvrp.search import RelocateWithDepot
from tests.helpers import make_search_route
def test_can_insert_reload_after_start_depot():
"""
Tests that Reloca... | "1 2") | assert_* | string_literal | tests/search/test_RelocateWithDepot.py | test_can_insert_reload_after_start_depot | 274 | null | |
PyVRP/PyVRP | import pickle
from numpy.testing import assert_, assert_equal, assert_raises
from pytest import mark
from pyvrp._pyvrp import DynamicBitset
def test_bit_and():
"""
Tests the intersection operator.
"""
bitset1 = DynamicBitset(128)
bitset1[0] = True
bitset1[64] = True
bitset2 = DynamicBits... | 1) | assert_* | numeric_literal | tests/test_DynamicBitset.py | test_bit_and | 158 | null | |
PyVRP/PyVRP | from numpy.testing import assert_, assert_equal
import pyvrp
from pyvrp import CostEvaluator
from pyvrp.search import compute_neighbours
from pyvrp.search._search import SearchSpace, Solution
def test_load_unload(ok_small):
"""
Tests that loading and then unloading an unchanged solution returns the
same o... | pyvrp_sol) | assert_* | variable | tests/search/test_Solution.py | test_load_unload | 18 | null | |
PyVRP/PyVRP | import numpy as np
import pytest
from numpy.testing import assert_, assert_equal
from pyvrp import Client, CostEvaluator, Depot, ProblemData, VehicleType
from pyvrp.search import RelocateWithDepot
from tests.helpers import make_search_route
def test_inserts_depot_across_routes(ok_small_multiple_trips):
"""
Te... | "3") | assert_* | string_literal | tests/search/test_RelocateWithDepot.py | test_inserts_depot_across_routes | 51 | null | |
PyVRP/PyVRP | import numpy as np
import pytest
from numpy.testing import assert_, assert_equal, assert_raises
from pyvrp import (
Client,
CostEvaluator,
Depot,
ProblemData,
Route,
Solution,
VehicleType,
)
def test_tw_penalty():
"""
This test asserts that time window penalty computations are corr... | 4) | assert_* | numeric_literal | tests/test_CostEvaluator.py | test_tw_penalty | 92 | null | |
PyVRP/PyVRP | import sys
import pytest
from numpy.testing import (
assert_,
assert_allclose,
assert_equal,
assert_raises,
)
from pyvrp import PenaltyManager, PenaltyParams, Solution, VehicleType
from pyvrp.exceptions import PenaltyBoundWarning
def test_load_penalty_update_decrease(ok_small):
"""
Tests that... | 4) | assert_* | numeric_literal | tests/test_PenaltyManager.py | test_load_penalty_update_decrease | 152 | null | |
PyVRP/PyVRP | import numpy as np
import pytest
from numpy.testing import assert_, assert_equal, assert_raises
from pyvrp import (
Client,
ClientGroup,
Depot,
Model,
PenaltyParams,
Profile,
SolveParams,
VehicleType,
)
from pyvrp.constants import MAX_VALUE
from pyvrp.exceptions import ScalingWarning
fr... | 1) | assert_* | numeric_literal | tests/test_Model.py | test_model_data | 36 | null | |
PyVRP/PyVRP | import numpy as np
from numpy.testing import assert_, assert_allclose, assert_equal
from pyvrp.IteratedLocalSearch import IteratedLocalSearchParams
from pyvrp.PenaltyManager import PenaltyParams
from pyvrp.search import (
OPERATORS,
Exchange10,
NeighbourhoodParams,
PerturbationParams,
SwapTails,
)
... | operators) | assert_* | variable | tests/test_solve.py | test_solve_params_from_file | 47 | null | |
PyVRP/PyVRP | import pickle
from numpy.testing import assert_, assert_equal, assert_raises
from pytest import mark
from pyvrp._pyvrp import DynamicBitset
def test_bit_xor():
"""
Tests the symmetric difference operator.
"""
bitset1 = DynamicBitset(128)
bitset1[0] = True
bitset1[64] = True
bitset2 = Dyn... | 2) | assert_* | numeric_literal | tests/test_DynamicBitset.py | test_bit_xor | 177 | null | |
PyVRP/PyVRP | import numpy as np
from numpy.testing import assert_, assert_equal
from pyvrp import (
Client,
ClientGroup,
CostEvaluator,
Depot,
ProblemData,
VehicleType,
)
from pyvrp.search import RemoveOptional
from tests.helpers import make_search_route
def test_fixed_vehicle_cost():
"""
Tests tha... | (-13, True)) | assert_* | collection | tests/search/test_RemoveOptional.py | test_fixed_vehicle_cost | 106 | null | |
PyVRP/PyVRP | import pytest
from numpy.testing import assert_, assert_equal, assert_raises
from pyvrp import RandomNumberGenerator
from pyvrp.search import NeighbourhoodParams, compute_neighbours
from pyvrp.search._search import SearchSpace
from tests.helpers import make_search_route
def test_search_order_and_shuffle(ok_small_two_... | [1, 2, 3, 4]) | assert_* | collection | tests/search/test_SearchSpace.py | test_search_order_and_shuffle | 186 | null | |
PyVRP/PyVRP | import numpy as np
from numpy.testing import assert_, assert_allclose, assert_equal
from pytest import mark
from pyvrp import RandomNumberGenerator
def test_randint():
"""
The ``randint(high)`` function returns a random integer between
``[0, high]``. Internally, this relies on ``__call__`` (see previous t... | 1236469084 % 100) | assert_* | complex_expr | tests/test_RandomNumberGenerator.py | test_randint | 41 | null | |
PyVRP/PyVRP | import numpy as np
import pytest
from numpy.testing import assert_, assert_equal
from pyvrp import Client, CostEvaluator, Depot, ProblemData, VehicleType
from pyvrp.search import RelocateWithDepot
from tests.helpers import make_search_route
def test_inserts_depot_across_routes(ok_small_multiple_trips):
"""
Te... | "") | assert_* | string_literal | tests/search/test_RelocateWithDepot.py | test_inserts_depot_across_routes | 66 | null | |
PyVRP/PyVRP | import numpy as np
import pytest
from numpy.testing import assert_, assert_equal
from pyvrp._pyvrp import LoadSegment
_INT_MAX = np.iinfo(np.int64).max
def test_excess_load_capacity():
"""
Tests that excess load is correctly evaluated and merged.
"""
before = LoadSegment(5, 5, 5, 30)
after = Load... | 7) | assert_* | numeric_literal | tests/test_LoadSegment.py | test_excess_load_capacity | 73 | null | |
PyVRP/PyVRP | import numpy as np
import pytest
from numpy.testing import assert_, assert_equal
from pyvrp._pyvrp import LoadSegment
_INT_MAX = np.iinfo(np.int64).max
@pytest.mark.parametrize(
("first", "second", "exp_delivery", "exp_pickup", "exp_load"),
[
(
LoadSegment(delivery=5, pickup=8, load=8),
... | exp_load) | assert_* | variable | tests/test_LoadSegment.py | test_merge_two | 56 | null | |
PyVRP/PyVRP | import numpy as np
import pytest
from numpy.testing import assert_, assert_equal
from pyvrp._pyvrp import LoadSegment
_INT_MAX = np.iinfo(np.int64).max
def test_excess_load_capacity():
"""
Tests that excess load is correctly evaluated and merged.
"""
before = LoadSegment(5, 5, 5, 30)
after = Load... | 42) | assert_* | numeric_literal | tests/test_LoadSegment.py | test_excess_load_capacity | 75 | null | |
PyVRP/PyVRP | from numpy.testing import assert_, assert_equal
from pyvrp import CostEvaluator, Depot
from pyvrp.search import RemoveAdjacentDepot
from pyvrp.search._search import Node
from tests.helpers import make_search_route
def test_cannot_evaluate_unassigned(ok_small_multiple_trips):
"""
Tests that RemoveAdjacentDepot... | (0, False)) | assert_* | collection | tests/search/test_RemoveAdjacentDepot.py | test_cannot_evaluate_unassigned | 18 | null | |
PyVRP/PyVRP | from numpy.testing import assert_, assert_equal
from pyvrp.RingBuffer import RingBuffer
def test_ring_buffer():
"""
Tests that the ring buffer correctly tracks recently inserted values, up to
a fixed size, and can be cleared to reset its state.
"""
buffer = RingBuffer(maxlen=2)
assert_equal(bu... | 0) | assert_* | numeric_literal | tests/test_RingBuffer.py | test_ring_buffer | 13 | null | |
PyVRP/PyVRP | from numpy.testing import assert_, assert_equal, assert_raises
from pyvrp import minimise_fleet
from pyvrp.stop import MaxIterations
from tests.helpers import read
def test_raises_multiple_vehicle_types(ok_small_multi_depot):
"""
Tests that ``minimise_fleet`` raises when given an instance with multiple
ve... | ValueError) | assert_* | variable | tests/test_minimise_fleet.py | test_raises_multiple_vehicle_types | 15 | null | |
PyVRP/PyVRP | import numpy as np
import pytest
from numpy.testing import assert_, assert_equal, assert_raises
import pyvrp
from pyvrp import Client, Depot, ProblemData, VehicleType
from pyvrp.search._search import Node, Route
from tests.helpers import make_search_route
_INT_MAX = np.iinfo(np.int64).max
@pytest.mark.parametrize("l... | 0) | assert_* | numeric_literal | tests/search/test_Route.py | test_node_init | 20 | null | |
PyVRP/PyVRP | import pytest
from numpy.testing import assert_, assert_equal
from pyvrp import CostEvaluator, Solution, Statistics
def test_iterating_over_statistics_returns_data(ok_small):
"""
Tests that iterating over a Statistics object yields the correct data.
"""
stats = Statistics()
assert_equal(list(stats... | cost) | assert_* | variable | tests/test_Statistics.py | test_iterating_over_statistics_returns_data | 139 | null | |
PyVRP/PyVRP | import pickle
from copy import copy, deepcopy
import numpy as np
import pytest
from numpy.testing import assert_, assert_allclose, assert_equal, assert_raises
from pyvrp import (
Client,
ClientGroup,
Depot,
ProblemData,
RandomNumberGenerator,
Route,
Solution,
Trip,
VehicleType,
)
f... | 1) | assert_* | numeric_literal | tests/test_Solution.py | test_route_constructor_with_different_vehicle_types | 59 | null | |
PyVRP/PyVRP | from math import sqrt
import numpy as np
import pytest
from numpy.testing import (
assert_,
assert_allclose,
assert_equal,
assert_raises,
)
from pyvrp import CostEvaluator
from pyvrp.constants import MAX_VALUE
from pyvrp.exceptions import ScalingWarning
from tests.helpers import read, read_solution
d... | 5) | assert_* | numeric_literal | tests/test_read.py | test_multiple_depots | 246 | null | |
PyVRP/PyVRP | import pytest
from numpy.testing import assert_, assert_equal
from pyvrp import CostEvaluator, Solution, Statistics
def test_csv_serialises_correctly(ok_small, tmp_path):
"""
Tests that writing a CSV of a ``Statistics`` object and then reading that
CSV again returns the same object.
"""
sol = Solu... | read_stats) | assert_* | variable | tests/test_Statistics.py | test_csv_serialises_correctly | 30 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.