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 |
|---|---|---|---|---|---|---|---|---|---|
dedalus-labs/dedalus-sdk-python | from __future__ import annotations
import os
from typing import Any, cast
import pytest
from tests.utils import assert_matches_type
from dedalus_labs import Dedalus, AsyncDedalus
from dedalus_labs.types import Model, ListModelsResponse
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
class T... | True | assert | bool_literal | tests/api_resources/test_models.py | test_raw_response_retrieve | TestModels | 35 | null |
dedalus-labs/dedalus-sdk-python | from __future__ import annotations
from typing import Any
import pytest
from dedalus_labs.lib.mcp import (
serialize_connection,
collect_unique_connections,
match_credentials_to_connections,
validate_credentials_for_servers,
)
class TestSerializeConnection:
def test_with_connection_object(self)... | 60000 | assert | numeric_literal | tests/test_mcp_wire_connections.py | test_with_connection_object | TestSerializeConnection | 96 | null |
dedalus-labs/dedalus-sdk-python | from __future__ import annotations
import os
from typing import Any, cast
import httpx
import pytest
from respx import MockRouter
from dedalus_labs import Dedalus, AsyncDedalus
from dedalus_labs._response import (
BinaryAPIResponse,
AsyncBinaryAPIResponse,
StreamedBinaryAPIResponse,
AsyncStreamedBina... | {"foo": "bar"} | assert | collection | tests/api_resources/audio/test_speech.py | test_method_create | TestSpeech | 36 | null |
dedalus-labs/dedalus-sdk-python | from __future__ import annotations
import os
from typing import Any, cast
import pytest
from tests.utils import assert_matches_type
from dedalus_labs import Dedalus, AsyncDedalus
from dedalus_labs.types import ImagesResponse
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
class TestImages:
... | image) | assert_* | variable | tests/api_resources/test_images.py | test_raw_response_create_variation | TestImages | 51 | null |
dedalus-labs/dedalus-sdk-python | from __future__ import annotations
import json
from typing import List
from typing_extensions import Literal
import httpx
import pytest
from respx import MockRouter
from pydantic import BaseModel
from dedalus_labs import Dedalus, AsyncDedalus
from dedalus_labs.lib._tools import pydantic_function_tool
from dedalus_la... | "UK" | assert | string_literal | tests/lib/chat/test_completions.py | test_parse_pydantic_tool | TestSyncParse | 218 | null |
dedalus-labs/dedalus-sdk-python | from typing import Type, Union
from datetime import date, datetime, timezone, timedelta
import pytest
from dedalus_labs._utils import parse_date, parse_datetime
def create_tz(minutes: int) -> timezone:
return timezone(timedelta(minutes=minutes))
@pytest.mark.parametrize(
"value,result",
[
# Vali... | result | assert | variable | tests/test_utils/test_datetime_parse.py | test_date_parsing | 58 | null | |
dedalus-labs/dedalus-sdk-python | from dedalus_labs._utils import deepcopy_minimal
def assert_different_identities(obj1: object, obj2: object) -> None:
assert obj1 == obj2
assert id(obj1) != id(obj2)
def test_ignores_other_types() -> None:
# custom classes
my_obj = MyObject()
obj1 = {"foo": my_obj}
obj2 = deepcopy_minimal(obj1... | my_obj | assert | variable | tests/test_deepcopy.py | test_ignores_other_types | 53 | null | |
dedalus-labs/dedalus-sdk-python | from dedalus_labs._utils import deepcopy_minimal
def assert_different_identities(obj1: object, obj2: object) -> None:
assert obj1 == obj2
assert id(obj1) != id(obj2)
def test_ignores_other_types() -> None:
# custom classes
my_obj = MyObject()
obj1 = {"foo": my_obj}
obj2 = deepcopy_minimal(obj1... | obj4 | assert | variable | tests/test_deepcopy.py | test_ignores_other_types | 58 | null | |
dedalus-labs/dedalus-sdk-python | from __future__ import annotations
import base64
import json
from typing import Any
import pytest
pytest.importorskip("cryptography")
from cryptography.hazmat.primitives.asymmetric import rsa, padding
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.ciphers.aead import AESGCM
fr... | ValueError, match="missing required JWK field") | pytest.raises | complex_expr | tests/test_encryption.py | test_missing_n_raises | TestJwkToPublicKey | 132 | null |
dedalus-labs/dedalus-sdk-python | from __future__ import annotations
from urllib.parse import parse_qs, urlparse
import httpx
import pytest
from dedalus_labs._exceptions import APIError, APIStatusError, BadRequestError
from dedalus_labs.lib._bug_report import generate_bug_report_url, get_bug_report_url_from_error
class TestGenerateBugReportUrl:
... | ["0.0.1"] | assert | collection | tests/test__bug_report.py | test_all_parameters | TestGenerateBugReportUrl | 52 | null |
dedalus-labs/dedalus-sdk-python | import operator
from typing import Any
from typing_extensions import override
from dedalus_labs._utils import LazyProxy
def test_recursive_proxy() -> None:
proxy = RecursiveLazyProxy()
assert repr(proxy) == | "RecursiveLazyProxy" | assert | string_literal | tests/test_utils/test_proxy.py | test_recursive_proxy | 19 | null | |
dedalus-labs/dedalus-sdk-python | from __future__ import annotations
import io
import pathlib
from typing import Any, Dict, List, Union, TypeVar, Iterable, Optional, cast
from datetime import date, datetime
from typing_extensions import Required, Annotated, TypedDict
import pytest
from dedalus_labs._types import Base64FileInput, omit, not_given
from... | "foo" | assert | string_literal | tests/test_transform.py | test_pydantic_default_field | 344 | null | |
dedalus-labs/dedalus-sdk-python | from __future__ import annotations
import os
from typing import Any, cast
import pytest
from tests.utils import assert_matches_type
from dedalus_labs import Dedalus, AsyncDedalus
from dedalus_labs.types.chat import (
ChatCompletion,
)
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
clas... | True | assert | bool_literal | tests/api_resources/chat/test_completions.py | test_raw_response_create_overload_1 | TestCompletions | 148 | null |
dedalus-labs/dedalus-sdk-python | from __future__ import annotations
from urllib.parse import parse_qs, urlparse
import httpx
import pytest
from dedalus_labs._exceptions import APIError, APIStatusError, BadRequestError
from dedalus_labs.lib._bug_report import generate_bug_report_url, get_bug_report_url_from_error
class TestGetBugReportUrlFromError:... | 0 | assert | numeric_literal | tests/test__bug_report.py | test_includes_sdk_version | TestGetBugReportUrlFromError | 136 | null |
dedalus-labs/dedalus-sdk-python | from __future__ import annotations
import io
import pathlib
from typing import Any, Dict, List, Union, TypeVar, Iterable, Optional, cast
from datetime import date, datetime
from typing_extensions import Required, Annotated, TypedDict
import pytest
from dedalus_labs._types import Base64FileInput, omit, not_given
from... | {"prop": None} | assert | collection | tests/test_transform.py | test_datetime_with_alias | 265 | null | |
dedalus-labs/dedalus-sdk-python | from __future__ import annotations
from typing import Iterator, AsyncIterator
import httpx
import pytest
from dedalus_labs import Dedalus, AsyncDedalus
from dedalus_labs._streaming import Stream, AsyncStream, ServerSentEvent
@pytest.mark.asyncio
@pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"])... | None | assert | none_literal | tests/test_streaming.py | test_data_missing_event | 39 | null | |
dedalus-labs/dedalus-sdk-python | from __future__ import annotations
import io
import pathlib
from typing import Any, Dict, List, Union, TypeVar, Iterable, Optional, cast
from datetime import date, datetime
from typing_extensions import Required, Annotated, TypedDict
import pytest
from dedalus_labs._types import Base64FileInput, omit, not_given
from... | "06" | assert | string_literal | tests/test_transform.py | test_datetime_custom_format | 255 | null | |
dedalus-labs/dedalus-sdk-python | from __future__ import annotations
import io
import pathlib
from typing import Any, Dict, List, Union, TypeVar, Iterable, Optional, cast
from datetime import date, datetime
from typing_extensions import Required, Annotated, TypedDict
import pytest
from dedalus_labs._types import Base64FileInput, omit, not_given
from... | {"FOO": "bar"} | assert | collection | tests/test_transform.py | test_iterable_union_str | 407 | null | |
dedalus-labs/dedalus-sdk-python | from __future__ import annotations
import gc
import os
import sys
import json
import asyncio
import inspect
import tracemalloc
from typing import Any, Union, cast
from unittest import mock
from typing_extensions import Literal
import httpx
import pytest
from respx import MockRouter
from pydantic import ValidationErro... | 1 | assert | numeric_literal | tests/test_client.py | test_union_response_different_types | TestDedalus | 547 | null |
dedalus-labs/dedalus-sdk-python | from __future__ import annotations
import json
from typing import Any
import pytest
from pydantic import ValidationError
from dedalus_labs.lib.mcp import (
MCPServerWireSpec,
serialize_mcp_servers,
MCPServerProtocol,
is_mcp_server,
)
class TestMCPServerWireSpecConstruction:
def test_from_slug_w... | "v2" | assert | string_literal | tests/test_mcp_wire.py | test_from_slug_with_embedded_version | TestMCPServerWireSpecConstruction | 75 | null |
dedalus-labs/dedalus-sdk-python | from __future__ import annotations
from typing import List, Generic, Iterator, cast
from typing_extensions import Literal, TypeVar
import httpx
import pytest
from respx import MockRouter
from pydantic import BaseModel
from dedalus_labs import Dedalus, AsyncDedalus
from dedalus_labs.lib._tools import pydantic_functio... | "Hello there!" | assert | string_literal | tests/lib/chat/test_completions_streaming.py | test_stream_basic | TestSyncStream | 83 | null |
dedalus-labs/dedalus-sdk-python | from dedalus_labs._utils import deepcopy_minimal
def assert_different_identities(obj1: object, obj2: object) -> None:
assert obj1 == obj2
assert id(obj1) != id(obj2)
def test_ignores_other_types() -> None:
# custom classes
my_obj = MyObject()
obj1 = {"foo": my_obj}
obj2 = deepcopy_minimal(obj1... | obj2) | assert_* | variable | tests/test_deepcopy.py | test_ignores_other_types | 52 | null | |
dedalus-labs/dedalus-sdk-python | from typing import Any, cast
from functools import partial
from urllib.parse import unquote
import pytest
from dedalus_labs._qs import Querystring, stringify
def test_array_repeat() -> None:
assert unquote(stringify({"in": ["foo", "bar"]})) == | "in=foo&in=bar" | assert | string_literal | tests/test_qs.py | test_array_repeat | 58 | null | |
dedalus-labs/dedalus-sdk-python | from __future__ import annotations
from typing import Any
import pytest
from dedalus_labs.lib.mcp import (
serialize_connection,
collect_unique_connections,
match_credentials_to_connections,
validate_credentials_for_servers,
)
class TestSerializeConnection:
def test_with_dict(self) -> None:
... | data | assert | variable | tests/test_mcp_wire_connections.py | test_with_dict | TestSerializeConnection | 104 | null |
dedalus-labs/dedalus-sdk-python | from __future__ import annotations
from typing import List, Generic, Iterator, cast
from typing_extensions import Literal, TypeVar
import httpx
import pytest
from respx import MockRouter
from pydantic import BaseModel
from dedalus_labs import Dedalus, AsyncDedalus
from dedalus_labs.lib._tools import pydantic_functio... | "stop" | assert | string_literal | tests/lib/chat/test_completions_streaming.py | test_stream_basic | TestSyncStream | 84 | null |
dedalus-labs/dedalus-sdk-python | import json
from typing import Any, List, Union, cast
from typing_extensions import Annotated
import httpx
import pytest
import pydantic
from dedalus_labs import Dedalus, BaseModel, AsyncDedalus
from dedalus_labs._response import (
APIResponse,
BaseAPIResponse,
AsyncAPIResponse,
BinaryAPIResponse,
... | 2 | assert | numeric_literal | tests/test_response.py | test_response_parse_custom_model | 140 | null | |
dedalus-labs/dedalus-sdk-python | from __future__ import annotations
from urllib.parse import parse_qs, urlparse
import httpx
import pytest
from dedalus_labs._exceptions import APIError, APIStatusError, BadRequestError
from dedalus_labs.lib._bug_report import generate_bug_report_url, get_bug_report_url_from_error
class TestGenerateBugReportUrl:
... | ["dev"] | assert | collection | tests/test__bug_report.py | test_all_parameters | TestGenerateBugReportUrl | 55 | null |
dedalus-labs/dedalus-sdk-python | from __future__ import annotations
import io
import pathlib
from typing import Any, Dict, List, Union, TypeVar, Iterable, Optional, cast
from datetime import date, datetime
from typing_extensions import Required, Annotated, TypedDict
import pytest
from dedalus_labs._types import Base64FileInput, omit, not_given
from... | {"foo": "hi!"} | assert | collection | tests/test_transform.py | test_pydantic_model_to_dictionary | 278 | null | |
dedalus-labs/dedalus-sdk-python | from __future__ import annotations
import os
import inspect
import traceback
import contextlib
from typing import Any, TypeVar, Iterator, Sequence, cast
from datetime import date, datetime
from typing_extensions import Literal, get_args, get_origin, assert_type
from dedalus_labs._types import Omit, NoneType
from deda... | field_value) | assert_* | variable | tests/utils.py | assert_matches_model | 38 | null | |
dedalus-labs/dedalus-sdk-python | from __future__ import annotations
import json
from typing import Any
import pytest
from pydantic import ValidationError
from dedalus_labs.lib.mcp import (
MCPServerWireSpec,
serialize_mcp_servers,
MCPServerProtocol,
is_mcp_server,
)
class TestMCPServerWireSpecValidation:
def test_slug_with_at_... | "v1" | assert | string_literal | tests/test_mcp_wire.py | test_slug_with_at_sign_rejected_by_pattern | TestMCPServerWireSpecValidation | 141 | null |
dedalus-labs/dedalus-sdk-python | from __future__ import annotations
import base64
import json
from typing import Any
import pytest
pytest.importorskip("cryptography")
from cryptography.hazmat.primitives.asymmetric import rsa, padding
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.ciphers.aead import AESGCM
fr... | expected_public.public_numbers().n | assert | func_call | tests/test_encryption.py | test_valid_jwk | TestJwkToPublicKey | 121 | null |
dedalus-labs/dedalus-sdk-python | from __future__ import annotations
import os
from typing import Any, cast
import httpx
import pytest
from respx import MockRouter
from dedalus_labs import Dedalus, AsyncDedalus
from dedalus_labs._response import (
BinaryAPIResponse,
AsyncBinaryAPIResponse,
StreamedBinaryAPIResponse,
AsyncStreamedBina... | "python" | assert | string_literal | tests/api_resources/audio/test_speech.py | test_raw_response_create | TestSpeech | 70 | null |
dedalus-labs/dedalus-sdk-python | from typing import Any, cast
from functools import partial
from urllib.parse import unquote
import pytest
from dedalus_labs._qs import Querystring, stringify
def test_basic() -> None:
assert stringify({"a": 1}) == | "a=1" | assert | string_literal | tests/test_qs.py | test_basic | 17 | null | |
webis-de/small-text | import unittest
import numpy as np
from numpy.testing import assert_array_equal
from scipy.sparse import csr_matrix
from small_text.utils.classification import empty_result, prediction_result
from tests.utils.testing import assert_csr_matrix_equal
class ClassificationUtilsTest(unittest.TestCase):
def test_empt... | prediction.dtype) | self.assertEqual | complex_expr | tests/unit/small_text/utils/test_classification.py | test_empty_result_single_label_prediction | ClassificationUtilsTest | 124 | null |
webis-de/small-text | import unittest
import pytest
import numpy as np
from unittest.mock import patch
from small_text.base import LABEL_UNLABELED
from small_text.integrations.pytorch.exceptions import PytorchNotFoundError
class KimCNNTest(unittest.TestCase):
def _get_clf(self, num_classes=2):
embedding_matrix = torch.rand(1... | classifier.model) | self.assertIsNone | complex_expr | tests/unit/small_text/integrations/pytorch/classifiers/test_kimcnn.py | test_init_default_parameters | KimCNNTest | 56 | null |
webis-de/small-text | import unittest
import small_text
from small_text.base import check_optional_dependency
from small_text.exceptions import MissingOptionalDependencyError
class OptionalDependenciesTest(unittest.TestCase):
def test_check_optional_dependency(self):
small_text.base.OPTIONAL_DEPENDENCIES['not_installed'] = 'm... | context.expected) | self.assertEqual | complex_expr | tests/unit/small_text/test_base.py | test_check_optional_dependency | OptionalDependenciesTest | 18 | null |
webis-de/small-text | import unittest
import numpy as np
from numpy.testing import assert_array_equal, assert_array_almost_equal
from scipy.sparse import csr_matrix
from sklearn.preprocessing import normalize
from unittest.mock import patch, Mock
from small_text.classifiers import ConfidenceEnhancedLinearSVC, SklearnClassifier
from small... | len(indices)) | self.assertEqual | func_call | tests/unit/small_text/query_strategies/test_strategies.py | test_simple_query | SamplingStrategiesTests | 80 | null |
webis-de/small-text | import unittest
import numpy as np
from numpy.testing import assert_array_equal
from scipy.sparse import csr_matrix
from small_text.data import balanced_sampling, stratified_sampling
from small_text.data.sampling import _get_class_histogram
from small_text.utils.labels import list_to_csr
class StratifiedSamplingTest... | len(indices)) | self.assertEqual | func_call | tests/unit/small_text/data/test_sampling.py | test_stratified_sampling | StratifiedSamplingTest | 46 | null |
webis-de/small-text | import numpy as np
from scipy.sparse import csr_matrix
from numpy.testing import assert_array_equal, assert_raises
def assert_array_not_equal(x, y):
assert_raises(AssertionError, assert_array_equal, x, y)
def assert_csr_matrix_equal(x, y, check_shape=True):
if check_shape and x.shape != y.shape:
rai... | y.indptr) | assert_* | complex_expr | tests/utils/testing.py | assert_csr_matrix_equal | 18 | null | |
webis-de/small-text | import numpy as np
class VectorIndexesTest(object):
def get_vector_index(self):
"""
Defines the vector index to be used for these test cases.
"""
raise NotImplementedError
def _get_random_data(self, n=20, d=4):
return np.random.rand(n, d).astype(np.float32)
def te... | distances.shape) | self.assertEqual | complex_expr | tests/integration/small_text/vector_indexes/test_base.py | test_search_with_return_distance | VectorIndexesTest | 70 | null |
webis-de/small-text | import unittest
import pytest
import numpy as np
from small_text.integrations.pytorch.exceptions import PytorchNotFoundError
from small_text.query_strategies import DiscriminativeActiveLearning
class DiscriminativeActiveLearningTest(unittest.TestCase):
def test_query_with_transformer_models(self):
trans... | indices.shape[0]) | self.assertEqual | complex_expr | tests/integration/small_text/integrations/transformers/query_strategies/test_dal.py | test_query_with_transformer_models | DiscriminativeActiveLearningTest | 41 | null |
webis-de/small-text | import unittest
import numpy as np
from numpy.testing import assert_array_equal
from scipy.sparse import csr_matrix
from small_text.base import LABEL_IGNORED
from small_text.utils.labels import (
concatenate,
csr_to_list,
get_ignored_labels_mask,
get_num_labels,
list_to_csr,
remove_by_index
)
... | result.data.dtype) | self.assertEqual | complex_expr | tests/unit/small_text/utils/test_labels.py | test_list_to_csr | LabelUtilsTest | 133 | null |
webis-de/small-text | import unittest
import numpy as np
from numpy.testing import assert_array_equal
from sklearn.feature_extraction.text import TfidfVectorizer
from unittest.mock import patch
from small_text.data import SklearnDataset, TextDataset
from tests.utils.datasets import random_labeling, random_labels
from tests.utils.testing i... | texts) | assert_* | variable | tests/unit/small_text/data/test_dataset_construction.py | test_from_arrays_with_lists | SklearnDatasetConstructionSingleLabelTest | 32 | null |
webis-de/small-text | import os
import unittest
import pytest
import small_text
import numpy as np
from importlib import reload
from unittest.mock import patch
from small_text.base import LABEL_UNLABELED
from small_text.integrations.pytorch.exceptions import PytorchNotFoundError
from small_text.utils.logging import VERBOSITY_MORE_VERBOSE... | model_args.config) | self.assertEqual | complex_expr | tests/unit/small_text/integrations/transformers/classifiers/test_classification.py | test_transformer_model_arguments_init | TestTransformerModelArguments | 55 | null |
webis-de/small-text | import unittest
import pytest
from unittest import mock
import torch
from small_text.integrations.pytorch.exceptions import PytorchNotFoundError
from tests.utils.datasets import twenty_news_transformers
from tests.utils.testing import assert_array_not_equal
class _EmbeddingTest(object):
def test_embed(self):
... | len(embeddings.shape)) | self.assertEqual | func_call | tests/integration/small_text/integrations/transformers/classifiers/test_classification_embeddings.py | test_embed | _EmbeddingTest | 63 | null |
webis-de/small-text | import unittest
import numpy as np
from unittest.mock import patch
from scipy.sparse import csr_matrix
from small_text.data import balanced_sampling, stratified_sampling
from small_text.initialization import random_initialization, \
random_initialization_stratified, random_initialization_balanced
from tests.util... | y) | assert_* | variable | tests/unit/small_text/initialization/test_strategies.py | test_random_initialization_stratified | RandomInitializationStratifiedTest | 42 | null |
webis-de/small-text | import unittest
import pytest
import numpy as np
from packaging.version import parse, Version
from unittest.mock import patch
from unittest import mock
from unittest.mock import Mock
from scipy.sparse import issparse, csr_matrix
from small_text.integrations.pytorch.exceptions import PytorchNotFoundError
from small_... | 0 <= acc <= 1) | self.assertTrue | complex_expr | tests/integration/small_text/integrations/pytorch/classifiers/test_kimcnn.py | test_fit_and_validate | _KimCNNClassifierTest | 158 | null |
webis-de/small-text | import unittest
import pytest
import numpy as np
from unittest.mock import patch, MagicMock
from small_text.integrations.pytorch.exceptions import PytorchNotFoundError
class ClassificationUtilsTest(unittest.TestCase):
def test_initialize_transformer_components(self):
transformer_model = TransformerModel... | kwargs['config']) | self.assertEqual | complex_expr | tests/unit/small_text/integrations/transformers/utils/test_classification.py | test_initialize_transformer_components | ClassificationUtilsTest | 85 | null |
webis-de/small-text | import unittest
import pytest
import numpy as np
from unittest.mock import Mock, patch
from sklearn.base import clone
from small_text.query_strategies.exceptions import EmptyPoolException
from small_text.classifiers import ConfidenceEnhancedLinearSVC, SklearnClassifierFactory
from small_text.query_strategies import ... | len(indices)) | self.assertEqual | func_call | tests/integration/small_text/query_strategies/test_query_strategies.py | test_query_takes_remaining_pool | SubsamplingQueryStrategyTest | 177 | null |
webis-de/small-text | import unittest
import numpy as np
from numpy.testing import assert_array_equal, assert_array_almost_equal
from scipy.sparse import csr_matrix
from sklearn.preprocessing import normalize
from unittest.mock import patch, Mock
from small_text.classifiers import ConfidenceEnhancedLinearSVC, SklearnClassifier
from small... | y.shape[0]) | self.assertEqual | complex_expr | tests/unit/small_text/query_strategies/test_strategies.py | _query | SamplingStrategiesTests | 142 | null |
webis-de/small-text | import unittest
import pytest
import warnings
import numpy as np
from packaging.version import parse, Version
from unittest import mock
from unittest.mock import patch, Mock
from scipy.sparse import issparse, csr_matrix
from small_text.integrations.pytorch.exceptions import PytorchNotFoundError
from small_text.trai... | amp_args) | self.assertIsNotNone | variable | tests/integration/small_text/integrations/transformers/classifiers/test_classification.py | test_with_no_amp_args_configured | TransformerBasedClassificationAMPArgumentsTest | 491 | null |
webis-de/small-text | import unittest
import numpy as np
from copy import copy
from numpy.testing import assert_array_equal
from scipy.sparse import csr_matrix
from small_text.base import LABEL_UNLABELED
from small_text.data.datasets import is_multi_label
from small_text.data.datasets import (
SklearnDataset,
DatasetView,
Te... | result.x) | assert_* | complex_expr | tests/unit/small_text/data/test_datasets.py | test_indexing_single_index | _TextDatasetTest | 553 | null |
webis-de/small-text | import unittest
import numpy as np
from unittest.mock import call, patch, Mock, ANY
from numpy.testing import assert_array_equal
from scipy import sparse
from scipy.sparse import csr_matrix, vstack
from small_text.active_learner import (
AbstractPoolBasedActiveLearner,
ActiveLearner,
PoolBasedActiveLearne... | len(indices)) | self.assertEqual | func_call | tests/unit/small_text/test_active_learner.py | test_query_update_mismatch | _PoolBasedActiveLearnerTest | 602 | null |
webis-de/small-text | import unittest
from sklearn.svm import LinearSVC
from sklearn.multiclass import OneVsRestClassifier
from sklearn.utils.validation import check_is_fitted, NotFittedError
from small_text.classifiers.classification import SklearnClassifier
from small_text.classifiers.factories import SklearnClassifierFactory
from tests... | clf_two) | self.assertNotEqual | variable | tests/unit/small_text/classifiers/test_factories.py | test_clone_resets_classifier | SklearnClassifierFactoryTest | 55 | null |
webis-de/small-text | import unittest
import pytest
import numpy as np
from abc import abstractmethod
from scipy.sparse import csr_matrix
from numpy.testing import assert_array_equal
from small_text.base import LABEL_UNLABELED
from small_text.data.exceptions import UnsupportedOperationException
from small_text.integrations.pytorch.excep... | ds.y) | assert_* | complex_expr | tests/unit/small_text/integrations/pytorch/test_datasets.py | test_get_labels | _PytorchTextClassificationDatasetTest | 134 | null |
webis-de/small-text | import unittest
import numpy as np
from numpy.testing import assert_array_equal
from scipy.sparse import csr_matrix
from small_text.data import balanced_sampling, stratified_sampling
from small_text.data.sampling import _get_class_histogram
from small_text.utils.labels import list_to_csr
class StratifiedSamplingTest... | counts[1]) | self.assertEqual | complex_expr | tests/unit/small_text/data/test_sampling.py | test_stratified_sampling | StratifiedSamplingTest | 51 | null |
webis-de/small-text | import unittest
import pytest
import numpy as np
from scipy.sparse import csr_matrix
from numpy.testing import assert_array_equal
from small_text.base import LABEL_UNLABELED
from small_text.integrations.pytorch.exceptions import PytorchNotFoundError
from tests.utils.misc import increase_dense_labels_safe
from test... | ds_new.x) | assert_* | complex_expr | tests/unit/small_text/integrations/transformers/test_datasets.py | test_set_features | _TransformersDatasetTest | 113 | null |
webis-de/small-text | import unittest
import numpy as np
from unittest.mock import call, patch, Mock, ANY
from numpy.testing import assert_array_equal
from scipy import sparse
from scipy.sparse import csr_matrix, vstack
from small_text.active_learner import (
AbstractPoolBasedActiveLearner,
ActiveLearner,
PoolBasedActiveLearne... | len(dataset)) | self.assertEqual | func_call | tests/unit/small_text/test_active_learner.py | test_update_with_unlabeled_instances | _PoolBasedActiveLearnerTest | 580 | null |
webis-de/small-text | import unittest
import numpy as np
from copy import copy
from numpy.testing import assert_array_equal
from scipy.sparse import csr_matrix
from small_text.data.datasets import (
DatasetView,
SklearnDataset,
SklearnDatasetView,
TextDataset,
TextDatasetView
)
from small_text.data.exceptions import U... | result.x) | assert_* | complex_expr | tests/unit/small_text/data/test_datatset_views.py | test_indexing_single_index | _TextDatasetViewTest | 416 | null |
webis-de/small-text | import numpy as np
from scipy.sparse import csr_matrix
from numpy.testing import assert_array_equal, assert_raises
def assert_array_not_equal(x, y):
assert_raises(AssertionError, assert_array_equal, x, | y) | assert_* | variable | tests/utils/testing.py | assert_array_not_equal | 9 | null | |
webis-de/small-text | import unittest
import numpy as np
from numpy.testing import assert_array_equal
from small_text.stopping_criteria.change import ClassificationChange
from small_text.utils.labels import list_to_csr
from tests.utils.testing import assert_csr_matrix_equal
class ClassificationChangeSingleLabelStopTest(unittest.TestCase... | stop) | self.assertFalse | variable | tests/unit/small_text/stopping_criteria/test_change.py | test_first_stop_call | ClassificationChangeSingleLabelStopTest | 45 | null |
webis-de/small-text | import unittest
import numpy as np
from numpy.testing import assert_array_equal
from scipy.sparse import csr_matrix
from small_text.data import balanced_sampling, stratified_sampling
from small_text.data.sampling import _get_class_histogram
from small_text.utils.labels import list_to_csr
class SamplingUtilsDenseTest... | counts) | assert_* | variable | tests/unit/small_text/data/test_sampling.py | test_get_class_histogram | SamplingUtilsDenseTest | 17 | null |
webis-de/small-text | import unittest
import numpy as np
from numpy.testing import assert_array_equal
from scipy.sparse import csr_matrix
from small_text.base import LABEL_IGNORED
from small_text.utils.labels import (
concatenate,
csr_to_list,
get_ignored_labels_mask,
get_num_labels,
list_to_csr,
remove_by_index
)
... | result) | assert_* | variable | tests/unit/small_text/utils/test_labels.py | test_concatenate_dense | LabelUtilsTest | 51 | null |
webis-de/small-text | import unittest
import pytest
import numpy as np
from scipy.sparse import csr_matrix
from numpy.testing import assert_array_equal
from small_text.base import LABEL_UNLABELED
from small_text.integrations.pytorch.exceptions import PytorchNotFoundError
from tests.utils.misc import increase_dense_labels_safe
from test... | ds._data) | self.assertIsNotNone | complex_expr | tests/unit/small_text/integrations/transformers/test_datasets.py | test_init | _TransformersDatasetTest | 53 | null |
webis-de/small-text | import unittest
import pytest
import numpy as np
from abc import abstractmethod
from scipy.sparse import csr_matrix
from numpy.testing import assert_array_equal
from small_text.base import LABEL_UNLABELED
from small_text.data.exceptions import UnsupportedOperationException
from small_text.integrations.pytorch.excep... | len(result)) | self.assertEqual | func_call | tests/unit/small_text/integrations/pytorch/test_datasets.py | test_indexing_single_index | _PytorchTextClassificationDatasetTest | 244 | null |
webis-de/small-text | import unittest
import numpy as np
from unittest.mock import call, patch, Mock, ANY
from numpy.testing import assert_array_equal
from scipy import sparse
from scipy.sparse import csr_matrix, vstack
from small_text.active_learner import (
AbstractPoolBasedActiveLearner,
ActiveLearner,
PoolBasedActiveLearne... | active_learner.y) | self.assertIsNone | complex_expr | tests/unit/small_text/test_active_learner.py | test_init | _PoolBasedActiveLearnerTest | 131 | null |
webis-de/small-text | import datetime
import unittest
from small_text.utils.datetime import format_timedelta
class DatetimeUtilsTest(unittest.TestCase):
def test_format_timedelta(self):
td1 = datetime.timedelta(hours=9, minutes=0, seconds=59)
self.assertEqual('09:00:59', format_timedelta(td1))
td2 = datetime.... | format_timedelta(td2)) | self.assertEqual | func_call | tests/unit/small_text/utils/test_datetime.py | test_format_timedelta | DatetimeUtilsTest | 19 | null |
webis-de/small-text | import unittest
import pytest
import numpy as np
from abc import abstractmethod
from scipy.sparse import csr_matrix
from numpy.testing import assert_array_equal
from small_text.base import LABEL_UNLABELED
from small_text.data.exceptions import UnsupportedOperationException
from small_text.integrations.pytorch.excep... | ds_cloned.x) | assert_* | complex_expr | tests/unit/small_text/integrations/pytorch/test_datasets.py | test_clone | _PytorchTextClassificationDatasetTest | 226 | null |
webis-de/small-text | import unittest
import warnings
import numpy as np
from small_text.classifiers import ConfidenceEnhancedLinearSVC
from small_text.query_strategies.bayesian import BALD, _bald
from tests.utils.datasets import random_sklearn_dataset
from tests.utils.testing import assert_array_equal
class BALDTest(unittest.TestCase):
... | str(strategy)) | self.assertEqual | func_call | tests/unit/small_text/query_strategies/test_bayesian.py | test_str | BALDTest | 64 | null |
webis-de/small-text | import importlib
import unittest
import pytest
from small_text.exceptions import MissingOptionalDependencyError
from small_text.integrations.pytorch.exceptions import PytorchNotFoundError
class TransformerBasedClassificationFactoryTest(unittest.TestCase):
def test_factory_new(self):
num_classes = 2
... | clf.num_classes) | self.assertEqual | complex_expr | tests/unit/small_text/integrations/transformers/classifiers/test_factories.py | test_factory_new | TransformerBasedClassificationFactoryTest | 37 | null |
webis-de/small-text | import unittest
import pytest
import numpy as np
from unittest.mock import patch
from small_text.base import LABEL_UNLABELED
from small_text.integrations.pytorch.exceptions import PytorchNotFoundError
class KimCNNTest(unittest.TestCase):
def _get_clf(self, num_classes=2):
embedding_matrix = torch.rand(1... | classifier.device) | self.assertIsNotNone | complex_expr | tests/unit/small_text/integrations/pytorch/classifiers/test_kimcnn.py | test_init_default_parameters | KimCNNTest | 38 | null |
webis-de/small-text | import unittest
import pytest
import numpy as np
from packaging.version import parse, Version
from unittest.mock import patch
from unittest import mock
from unittest.mock import Mock
from scipy.sparse import issparse, csr_matrix
from small_text.integrations.pytorch.exceptions import PytorchNotFoundError
from small_... | call_args[6]) | self.assertEqual | complex_expr | tests/integration/small_text/integrations/pytorch/classifiers/test_kimcnn.py | test_fit_with_optimizer_and_scheduler | _KimCNNClassifierTest | 326 | null |
webis-de/small-text | import unittest
from sklearn.datasets import fetch_20newsgroups
from sklearn.feature_extraction.text import CountVectorizer
from small_text.classifiers import ConfidenceEnhancedLinearSVC
class ConfidenceEnhancedLinearSVCIntegrationTest(unittest.TestCase):
def _get_20news_vectors(self, categories=None):
... | proba.shape[1]) | self.assertEqual | complex_expr | tests/integration/classifiers/test_svm.py | test_predict_binary_with_probas | ConfidenceEnhancedLinearSVCIntegrationTest | 46 | null |
webis-de/small-text | import unittest
from small_text.training.metrics import Metric
class MetricsTest(unittest.TestCase):
def test_repr(self):
metric = Metric('train_acc', dtype=float, lower_is_better=False)
self.assertEqual('Metric(\'train_acc\', dtype=float, lower_is_better=False)', | repr(metric)) | self.assertEqual | func_call | tests/unit/small_text/training/test_metrics.py | test_repr | MetricsTest | 10 | null |
webis-de/small-text | import unittest
from sklearn.svm import LinearSVC
from sklearn.multiclass import OneVsRestClassifier
from sklearn.utils.validation import check_is_fitted, NotFittedError
from small_text.classifiers.classification import SklearnClassifier
from small_text.classifiers.factories import SklearnClassifierFactory
from tests... | clf.num_classes) | self.assertEqual | complex_expr | tests/unit/small_text/classifiers/test_factories.py | test_new | SklearnClassifierFactoryTest | 33 | null |
webis-de/small-text | import numpy as np
from scipy.sparse import csr_matrix
from numpy.testing import assert_array_equal, assert_raises
def assert_array_not_equal(x, y):
assert_raises(AssertionError, assert_array_equal, x, y)
def assert_csr_matrix_equal(x, y, check_shape=True):
if check_shape and x.shape != y.shape:
rai... | y.data) | assert_* | complex_expr | tests/utils/testing.py | assert_csr_matrix_equal | 16 | null | |
webis-de/small-text | import unittest
import pytest
import numpy as np
from abc import abstractmethod
from scipy.sparse import csr_matrix
from numpy.testing import assert_array_equal
from small_text.base import LABEL_UNLABELED
from small_text.data.exceptions import UnsupportedOperationException
from small_text.integrations.pytorch.excep... | count) | self.assertEqual | variable | tests/unit/small_text/integrations/pytorch/test_datasets.py | test_iter | _PytorchTextClassificationDatasetTest | 295 | null |
webis-de/small-text | import os
import unittest
from unittest.mock import patch
from small_text.utils.system import (
OFFLINE_MODE_VARIABLE,
PROGRESS_BARS_VARIABLE,
TMP_DIR_VARIABLE,
get_offline_mode,
get_show_progress_bar_default,
get_tmp_dir_base
)
class SystemUtilsTest(unittest.TestCase):
def test_get_offl... | get_offline_mode()) | self.assertFalse | func_call | tests/unit/small_text/utils/test_system.py | test_get_offline_mode | SystemUtilsTest | 19 | null |
webis-de/small-text | import numpy as np
from scipy.sparse import csr_matrix
from numpy.testing import assert_array_equal, assert_raises
def assert_array_not_equal(x, y):
assert_raises(AssertionError, assert_array_equal, x, y)
def assert_csr_matrix_equal(x, y, check_shape=True):
if check_shape and x.shape != y.shape:
rai... | y.indices) | assert_* | complex_expr | tests/utils/testing.py | assert_csr_matrix_equal | 17 | null | |
webis-de/small-text | import unittest
import numpy as np
from copy import copy
from numpy.testing import assert_array_equal
from scipy.sparse import csr_matrix
from small_text.data.datasets import (
DatasetView,
SklearnDataset,
SklearnDatasetView,
TextDataset,
TextDatasetView
)
from small_text.data.exceptions import U... | ds_cloned.x) | assert_* | complex_expr | tests/unit/small_text/data/test_datatset_views.py | _clone_test | _TextDatasetViewTest | 369 | null |
webis-de/small-text | import unittest
import numpy as np
from small_text.classifiers import ConfidenceEnhancedLinearSVC
from small_text.query_strategies.vector_space import ProbCover
from tests.utils.datasets import random_sklearn_dataset
class BALDTest(unittest.TestCase):
def _get_clf(self):
return ConfidenceEnhancedLinearS... | str(strategy)) | self.assertEqual | func_call | tests/unit/small_text/query_strategies/test_vector_space.py | test_str | BALDTest | 21 | null |
webis-de/small-text | import unittest
import pytest
import numpy as np
from unittest.mock import create_autospec, patch
from scipy.sparse import issparse, csr_matrix
from small_text.exceptions import UnsupportedOperationException
from small_text.integrations.pytorch.exceptions import PytorchNotFoundError
from tests.utils.datasets import t... | amp_args) | self.assertIsNotNone | variable | tests/integration/small_text/integrations/transformers/classifiers/test_setfit.py | test_with_no_amp_args_configured | SetFitClassificationAMPArgumentsTest | 268 | null |
webis-de/small-text | import unittest
import pytest
import numpy as np
from unittest.mock import patch, MagicMock
from small_text.integrations.pytorch.exceptions import PytorchNotFoundError
class ClassificationUtilsTest(unittest.TestCase):
def test_initialize_transformer_components(self):
transformer_model = TransformerModel... | model) | self.assertIsNotNone | variable | tests/unit/small_text/integrations/transformers/utils/test_classification.py | test_initialize_transformer_components | ClassificationUtilsTest | 65 | null |
webis-de/small-text | import os
import unittest
import pytest
import small_text
import numpy as np
from importlib import reload
from unittest.mock import patch
from small_text.base import LABEL_UNLABELED
from small_text.integrations.pytorch.exceptions import PytorchNotFoundError
from small_text.utils.logging import VERBOSITY_MORE_VERBOSE... | proba.shape[0]) | self.assertEqual | complex_expr | tests/unit/small_text/integrations/transformers/classifiers/test_classification.py | test_predict_proba_on_empty_data | TestTransformerBasedClassification | 491 | null |
webis-de/small-text | import unittest
import pytest
import numpy as np
from small_text.integrations.pytorch.exceptions import PytorchNotFoundError
class TransformersDatasetTest(unittest.TestCase):
def test_init_and_len(self):
data = random_transformer_dataset(10)
dataset = TransformersDataset(data)
self.ass... | len(dataset)) | self.assertEqual | func_call | tests/integration/small_text/integrations/transformers/test_datasets.py | test_init_and_len | TransformersDatasetTest | 23 | null |
webis-de/small-text | import os
import unittest
import pytest
import small_text
from importlib import reload
from packaging.version import parse, Version
from unittest.mock import patch
from small_text.integrations.pytorch.exceptions import PytorchNotFoundError
from small_text.utils.logging import VERBOSITY_QUIET, VERBOSITY_MORE_VERBOSE
... | args.end_to_end) | self.assertFalse | complex_expr | tests/unit/small_text/integrations/transformers/classifiers/test_setfit.py | test_setfit_model_arguments_init_default | TestSetFitModelArguments | 47 | null |
webis-de/small-text | import unittest
import pytest
import numpy as np
from unittest.mock import patch, MagicMock
from small_text.integrations.pytorch.exceptions import PytorchNotFoundError
class ClassificationUtilsTest(unittest.TestCase):
def test_initialize_transformer_components(self):
transformer_model = TransformerModel... | config) | self.assertIsNotNone | variable | tests/unit/small_text/integrations/transformers/utils/test_classification.py | test_initialize_transformer_components | ClassificationUtilsTest | 63 | null |
webis-de/small-text | import unittest
import scipy
import numpy as np
from small_text.classifiers.classification import SklearnClassifier, ConfidenceEnhancedLinearSVC
from small_text.query_strategies.base import ClassificationType, argselect, constraints
from small_text.query_strategies.strategies import RandomSampling
from numpy.testing... | arr[indices]) | assert_* | complex_expr | tests/unit/small_text/query_strategies/test_base.py | test_argselect_n_equals_input_size | ArgselectTest | 181 | null |
webis-de/small-text | import unittest
from sklearn.datasets import fetch_20newsgroups
from sklearn.feature_extraction.text import CountVectorizer
from small_text.classifiers import ConfidenceEnhancedLinearSVC
class ConfidenceEnhancedLinearSVCIntegrationTest(unittest.TestCase):
def _get_20news_vectors(self, categories=None):
... | len(proba.shape)) | self.assertEqual | func_call | tests/integration/classifiers/test_svm.py | test_predict_binary_with_probas | ConfidenceEnhancedLinearSVCIntegrationTest | 44 | null |
webis-de/small-text | import unittest
import numpy as np
from numpy.testing import assert_array_equal, assert_array_almost_equal
from scipy.sparse import csr_matrix
from sklearn.preprocessing import normalize
from unittest.mock import patch, Mock
from small_text.classifiers import ConfidenceEnhancedLinearSVC, SklearnClassifier
from small... | indices) | assert_* | variable | tests/unit/small_text/query_strategies/test_strategies.py | test_breaking_ties_binary | BreakingTiesTest | 208 | null |
webis-de/small-text | import unittest
import numpy as np
from small_text.classifiers import ConfidenceEnhancedLinearSVC
from small_text.data.datasets import SklearnDataset
from small_text.query_strategies import (
EmptyPoolException,
greedy_coreset,
GreedyCoreset,
lightweight_coreset,
LightweightCoreset
)
from tests.un... | len(indices)) | self.assertEqual | func_call | tests/unit/small_text/query_strategies/test_coresets.py | test_simple_query | _CoresetSamplingStrategyTest | 97 | null |
webis-de/small-text | import unittest
import scipy
import numpy as np
from small_text.classifiers.classification import SklearnClassifier, ConfidenceEnhancedLinearSVC
from small_text.query_strategies.base import ClassificationType, argselect, constraints
from small_text.query_strategies.strategies import RandomSampling
from numpy.testing... | np.sort(arr[indices])) | assert_* | func_call | tests/unit/small_text/query_strategies/test_base.py | test_argselect_without_ties_maximum | ArgselectTest | 132 | null |
webis-de/small-text | import importlib
import unittest
import pytest
from small_text.exceptions import MissingOptionalDependencyError
from small_text.integrations.pytorch.exceptions import PytorchNotFoundError
class TransformerBasedClassificationFactoryTest(unittest.TestCase):
def test_factory_new(self):
num_classes = 2
... | clf.lr) | self.assertEqual | complex_expr | tests/unit/small_text/integrations/transformers/classifiers/test_factories.py | test_factory_new | TransformerBasedClassificationFactoryTest | 38 | null |
webis-de/small-text | import unittest
from sklearn.svm import LinearSVC
from sklearn.multiclass import OneVsRestClassifier
from sklearn.utils.validation import check_is_fitted, NotFittedError
from small_text.classifiers.classification import SklearnClassifier
from small_text.classifiers.factories import SklearnClassifierFactory
from tests... | clf.multi_label) | self.assertTrue | complex_expr | tests/unit/small_text/classifiers/test_factories.py | test_new_with_multi_label_kwarg | SklearnClassifierFactoryTest | 46 | null |
webis-de/small-text | import unittest
import numpy as np
from small_text.classifiers import ConfidenceEnhancedLinearSVC
from small_text.data.datasets import SklearnDataset
from small_text.query_strategies import (
EmptyPoolException,
greedy_coreset,
GreedyCoreset,
lightweight_coreset,
LightweightCoreset
)
from tests.un... | str(strategy)) | self.assertEqual | func_call | tests/unit/small_text/query_strategies/test_coresets.py | test_str | _CoresetSamplingStrategyTest | 118 | null |
webis-de/small-text | import unittest
import pytest
import numpy as np
from unittest.mock import patch, MagicMock
from small_text.integrations.pytorch.exceptions import PytorchNotFoundError
class BuildLayerSpecificParamsTest(unittest.TestCase):
def _assert_params(self, params, base_lr, num_different_lrs):
self.assertIsNotNon... | isinstance(param, dict)) | self.assertTrue | func_call | tests/unit/small_text/integrations/transformers/utils/test_classification.py | _assert_params | BuildLayerSpecificParamsTest | 186 | null |
webis-de/small-text | import datetime
import unittest
from small_text.utils.datetime import format_timedelta
class DatetimeUtilsTest(unittest.TestCase):
def test_format_timedelta(self):
td1 = datetime.timedelta(hours=9, minutes=0, seconds=59)
self.assertEqual('09:00:59', | format_timedelta(td1)) | self.assertEqual | func_call | tests/unit/small_text/utils/test_datetime.py | test_format_timedelta | DatetimeUtilsTest | 16 | null |
webis-de/small-text | import unittest
import pytest
import numpy as np
from packaging.version import parse, Version
from unittest.mock import patch
from unittest import mock
from unittest.mock import Mock
from scipy.sparse import issparse, csr_matrix
from small_text.integrations.pytorch.exceptions import PytorchNotFoundError
from small_... | y_pred.shape[0]) | self.assertEqual | complex_expr | tests/integration/small_text/integrations/pytorch/classifiers/test_kimcnn.py | test_fit_and_predict | _KimCNNClassifierTest | 69 | null |
webis-de/small-text | import unittest
import numpy as np
import pytest
from scipy.sparse import csr_matrix
from unittest.mock import patch
from small_text import prediction_result
from small_text.integrations.pytorch.exceptions import PytorchNotFoundError
from tests.utils.datasets import twenty_news_text
class _EmbeddingTest(object):
... | len(embeddings.shape)) | self.assertEqual | func_call | tests/integration/small_text/integrations/transformers/classifiers/test_setfit_embeddings.py | test_embed | _EmbeddingTest | 64 | null |
webis-de/small-text | import pytest
import unittest
from unittest.mock import Mock, patch
from small_text.integrations.pytorch.exceptions import PytorchNotFoundError
from small_text.training.model_selection import NoopModelSelection
from tests.utils.datasets import random_text_classification_dataset
class SimplePytorchClassifierTest(unit... | loss.reduction) | self.assertEqual | complex_expr | tests/unit/small_text/integrations/pytorch/classifiers/test_base.py | test_get_default_criterion_use_sample_weights_binary | SimplePytorchClassifierTest | 197 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.