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 |
|---|---|---|---|---|---|---|---|---|---|
scikit-fingerprints/scikit-fingerprints | import numpy as np
import pytest
from numpy.testing import assert_equal
from skfp.filters import PfizerFilter
def smiles_passing_pfizer() -> list[str]:
return [
"COC(=O)c1ccccc1NC(=O)CSc1nc(O)c(-c2ccccc2)c(=O)[nH]1",
"CS(=O)(=O)NCc1nnc(SCc2ccccc2C(F)(F)F)o1",
"COCCCn1c(C)nnc1SCC(=O)NCc1ccc... | (2,)) | assert_* | collection | tests/filters/pfizer.py | test_pfizer_condition_names | 123 | null | |
scikit-fingerprints/scikit-fingerprints | import numpy as np
from numpy.testing import assert_equal
from scipy.sparse import csr_array
from skfp.fingerprints import LaggnerFingerprint
def test_laggner_feature_names():
# we check a few selected feature names
laggner_fp = LaggnerFingerprint()
feature_names = laggner_fp.get_feature_names_out()
... | "Alkene") | assert_* | string_literal | tests/fingerprints/laggner.py | test_laggner_feature_names | 77 | null | |
scikit-fingerprints/scikit-fingerprints | import numpy as np
import pytest
from numpy.testing import assert_equal
from skfp.filters import OpreaFilter
def smiles_passing_oprea() -> list[str]:
return [
"C1CC1N2C=C(C(=O)C3=CC(=C(C=C32)N4CCNCC4)F)C(=O)O", # Ciprofloxacin
"CC(=O)CC(C1=CC=CC=C1)C2=C(C3=CC=CC=C3OC2=O)O", # Warfarin
]
def... | len(y)) | assert_* | func_call | tests/filters/oprea.py | test_oprea_return_condition_indicators_transform_x_y | 141 | null | |
scikit-fingerprints/scikit-fingerprints | import numpy as np
import pytest
from numpy.testing import assert_allclose, assert_equal
from rdkit import Chem
from rdkit.Chem import Mol
from skfp.model_selection.splitters.maxmin_split import (
maxmin_stratified_train_test_split,
maxmin_stratified_train_valid_test_split,
maxmin_train_test_split,
max... | s2) | assert_* | variable | tests/model_selection/splitters/maxmin_split.py | test_seed_consistency_train_valid_test_split | 66 | null | |
scikit-fingerprints/scikit-fingerprints | import pytest
from numpy.testing import assert_equal
from sklearn.utils._param_validation import InvalidParameterError
from skfp.datasets.tdc import load_tdc_benchmark, load_tdc_splits
from skfp.datasets.tdc.adme import (
load_b3db_classification,
load_b3db_regression,
load_bioavailability_ma,
load_cac... | len(valid) | assert | func_call | tests/datasets/tdc.py | test_load_tdc_splits | 116 | null | |
scikit-fingerprints/scikit-fingerprints | import numpy as np
from numpy.testing import assert_equal
from scipy.sparse import csr_array
from skfp.fingerprints import PhysiochemicalPropertiesFingerprint
def test_physiochemical_properties_bp_bit_fingerprint(smiles_list):
pp_fp = PhysiochemicalPropertiesFingerprint(variant="BP", n_jobs=-1)
X_skfp = pp_fp... | np.uint8 | assert | complex_expr | tests/fingerprints/physiochemical_properties.py | test_physiochemical_properties_bp_bit_fingerprint | 14 | null | |
scikit-fingerprints/scikit-fingerprints | import numpy as np
import pytest
from numpy.testing import assert_allclose, assert_equal
from rdkit.Chem.rdFingerprintGenerator import (
GetAtomPairGenerator,
GetMorganFeatureAtomInvGen,
)
from scipy.sparse import csr_array
from sklearn.utils._param_validation import InvalidParameterError
from skfp.fingerprint... | np.uint32 | assert | complex_expr | tests/fingerprints/atom_pair.py | test_atom_pair_count_fingerprint | 54 | null | |
scikit-fingerprints/scikit-fingerprints | import numpy as np
import pytest
from numpy.testing import assert_equal
from rdkit.Chem import Mol
from skfp.filters import LipinskiFilter
def smiles_passing_lipinski() -> list[str]:
return [
# paracetamol
"CC(=O)Nc1ccc(O)cc1",
# caffeine
"CN1C=NC2=C1C(=O)N(C(=O)N2C)C",
# n... | 6) | assert_* | numeric_literal | tests/filters/lipinski.py | test_mols_lipinski_various_conditions | 82 | null | |
scikit-fingerprints/scikit-fingerprints | import numpy as np
import pytest
from numpy.testing import assert_equal
from scipy.sparse import csr_array
from sklearn.utils._param_validation import InvalidParameterError
from skfp.bases.base_substructure_fp import BaseSubstructureFingerprint
def substructure_smiles_list() -> list[str]:
return [
"CCOC",... | np.uint8 | assert | complex_expr | tests/bases/base_substructure_fp.py | test_substructure_bit_fingerprint | 60 | null | |
scikit-fingerprints/scikit-fingerprints | import numpy as np
import pytest
from numpy.testing import assert_equal
from skfp.applicability_domain import KNNADChecker
from tests.applicability_domain.utils import get_data_inside_ad, get_data_outside_ad
ALLOWED_METRICS = [
"tanimoto_binary_distance",
"tanimoto_count_distance",
]
ALLOWED_AGGREGATIONS = [... | KeyError) | pytest.raises | variable | tests/applicability_domain/knn.py | test_knn_invalid_metric | 115 | null | |
scikit-fingerprints/scikit-fingerprints | import numpy as np
from numpy.testing import assert_allclose, assert_equal
from rdkit.Chem.EState.Fingerprinter import FingerprintMol
from scipy.sparse import csr_array
from skfp.fingerprints import EStateFingerprint
def test_estate_bit_fingerprint(smiles_list, mols_list):
estate_fp = EStateFingerprint(variant="b... | X_rdkit) | assert_* | variable | tests/fingerprints/estate.py | test_estate_bit_fingerprint | 15 | null | |
scikit-fingerprints/scikit-fingerprints | import numpy as np
from numpy.testing import assert_equal
from scipy.sparse import csr_array
from skfp.fingerprints import LaggnerFingerprint
def test_laggner_bit_fingerprint(smiles_list):
laggner_fp = LaggnerFingerprint(n_jobs=-1)
X = laggner_fp.transform(smiles_list)
assert isinstance(X, np.ndarray)
... | np.uint8 | assert | complex_expr | tests/fingerprints/laggner.py | test_laggner_bit_fingerprint | 14 | null | |
scikit-fingerprints/scikit-fingerprints | import numpy as np
from numpy.testing import assert_equal
from rdkit.Chem import Mol
from skfp.filters import ZINCDruglikeFilter
def test_zinc_druglike_condition_names():
filt = ZINCDruglikeFilter()
condition_names = filt.get_feature_names_out()
assert isinstance(condition_names, np.ndarray)
assert_... | (13,)) | assert_* | collection | tests/filters/zinc_druglike.py | test_zinc_druglike_condition_names | 49 | null | |
containers/ramalama | import re
import subprocess
from subprocess import CalledProcessError
import pytest
from test.conftest import skip_if_apple_silicon, skip_if_no_mlx, skip_if_not_apple_silicon
from test.e2e.utils import RamalamaExecWorkspace, check_output
MODEL = "hf://mlx-community/Llama-3.2-1B-Instruct-4bit"
@pytest.mark.e2e
def t... | result | assert | variable | test/e2e/test_mlx.py | test_runtime_mlx_help_shows_mlx_option | 17 | null | |
containers/ramalama | import argparse
from unittest.mock import patch
import pytest
from ramalama.command.context import RamalamaArgsContext
from ramalama.config import default_config
class TestMaxTokensConfig:
@pytest.mark.parametrize("value", ["0", "100", "1024", "4096", "0"])
def test_max_tokens_valid_values(self, value):
... | value | assert | variable | test/unit/test_max_tokens.py | test_max_tokens_valid_values | TestMaxTokensConfig | 69 | null |
containers/ramalama | import json
import platform
import re
from pathlib import Path
from subprocess import STDOUT, CalledProcessError
import pytest
from test.conftest import skip_if_docker, skip_if_no_container, skip_if_podman_too_old, skip_if_windows
from test.e2e.utils import RamalamaExecWorkspace, check_output
def path_to_uri(path):
... | model | assert | variable | test/e2e/test_artifact.py | test_artifact_lifecycle_basic | 306 | null | |
containers/ramalama | import json
import platform
import re
import shutil
from pathlib import Path
from subprocess import DEVNULL, PIPE, STDOUT, CalledProcessError
import pytest
from test.conftest import (
skip_if_container,
skip_if_darwin,
skip_if_docker,
skip_if_gh_actions_darwin,
skip_if_no_container,
skip_if_no... | exit_code | assert | variable | test/e2e/test_run.py | test_run_with_non_existing_images_new | 373 | null | |
containers/ramalama | import pytest
from ramalama.model_store import go2jinja
from ramalama.model_store.template_conversion import (
TemplateConversionError,
convert_go_to_jinja,
wrap_template_with_messages_loop,
)
class TestWrapTemplateWithMessagesLoop:
def test_basic_system_user_assistant(self):
"""Test basic te... | expected | assert | variable | test/unit/test_template_conversion.py | test_basic_system_user_assistant | TestWrapTemplateWithMessagesLoop | 32 | null |
containers/ramalama | from dataclasses import dataclass
from typing import Union
import pytest
import ramalama.transports.transport_factory as transport_factory_module
from ramalama.chat_providers.openai import OpenAIResponsesChatProvider
from ramalama.transports.api import APITransport
from ramalama.transports.huggingface import Huggingf... | "openai" | assert | string_literal | test/unit/test_transport_factory.py | test_transport_factory_passes_scheme_to_get_chat_provider | 187 | null | |
containers/ramalama | import json
import random
import re
import string
from pathlib import Path, PurePosixPath
from subprocess import STDOUT, CalledProcessError
import pytest
from ramalama.path_utils import normalize_host_path_for_container
from test.conftest import (
skip_if_big_endian_machine,
skip_if_darwin,
skip_if_little... | 22 | assert | numeric_literal | test/e2e/test_pull.py | test_pull_non_existing_model | 41 | null | |
containers/ramalama | import socket
from argparse import Namespace
from unittest.mock import MagicMock, Mock, patch
import pytest
from ramalama.command.factory import assemble_command
from ramalama.common import MNT_DIR
from ramalama.config import get_config
from ramalama.transports.base import Transport, compute_ports, compute_serving_po... | list | assert | variable | test/unit/test_transport_base.py | test_compute_ports | 100 | null | |
containers/ramalama | import os
import shutil
import subprocess
from contextlib import ExitStack
from pathlib import Path
from sys import platform
from unittest.mock import MagicMock, Mock, mock_open, patch
import pytest
from ramalama.cli import configure_subcommands, create_argument_parser, default_image, default_rag_image
from ramalama.... | config) | assert_* | variable | test/unit/test_common.py | test_apple_vm_returns_result | 170 | null | |
containers/ramalama | from pathlib import Path
import pytest
from ramalama.compose import Compose, genfile
@pytest.mark.parametrize(
"input_data,expected_file_name",
[
(
Input(
model_name="tinyllama",
model_src_path="/models/tinyllama.gguf",
model_dest_path="/mnt... | expected_content.strip() | assert | func_call | test/unit/test_compose.py | test_compose_generate | 188 | null | |
containers/ramalama | import io
import urllib.error
import pytest
import ramalama.chat_providers.base as base_module
from ramalama.chat_providers.base import ChatProviderError
from ramalama.chat_providers.openai import OpenAIResponsesChatProvider
def test_list_models_reports_auth_error(monkeypatch):
provider = OpenAIResponsesChatProv... | message | assert | variable | test/unit/test_chat_provider_base.py | test_list_models_reports_auth_error | 31 | null | |
containers/ramalama | import argparse
from unittest.mock import patch
import pytest
from ramalama.command.context import RamalamaArgsContext
from ramalama.config import default_config
class TestMaxTokensContext:
def test_max_tokens_context_default_none(self):
"""Test that max_tokens defaults to None when not provided."""
... | None | assert | none_literal | test/unit/test_max_tokens.py | test_max_tokens_context_default_none | TestMaxTokensContext | 163 | null |
containers/ramalama | import socket
from argparse import Namespace
from unittest.mock import MagicMock, Mock, patch
import pytest
from ramalama.command.factory import assemble_command
from ramalama.common import MNT_DIR
from ramalama.config import get_config
from ramalama.transports.base import Transport, compute_ports, compute_serving_po... | [expected_mount]) | assert_* | collection | test/unit/test_transport_base.py | test_setup_mounts_oci_docker | TestOCIModelSetupMounts | 332 | null |
containers/ramalama | import unittest
from argparse import Namespace
from http.client import HTTPException
from json import JSONDecodeError
from subprocess import TimeoutExpired
from unittest.mock import Mock, patch
import pytest
import ramalama.engine
@patch("ramalama.engine.HTTPConnection")
def test_is_healthy_unicode_fail(mock_conn):
... | 2 | assert | numeric_literal | test/unit/test_engine.py | test_is_healthy_unicode_fail | 170 | null | |
containers/ramalama | import sys
from contextlib import redirect_stderr, redirect_stdout
from subprocess import CalledProcessError
import pytest
def run_ramalama_direct(args):
"""Run ramalama directly via Python import to avoid installation issues"""
from ramalama.cli import main
# Save original sys.argv
original_argv = s... | result | assert | variable | test/e2e/test_cli_max_tokens.py | test_max_tokens_cli_argument_help | 54 | null | |
containers/ramalama | import pytest
from ramalama.cli_arg_normalization import normalize_pull_arg
class TestNormalizePullArg:
@pytest.mark.parametrize(
"pull_value,expected",
[
("always", "always"),
("missing", "missing"),
("never", "never"),
("newer", "always"),
... | expected | assert | variable | test/unit/test_cli_arg_normalization.py | test_docker_normalization | TestNormalizePullArg | 17 | null |
containers/ramalama | import argparse
from typing import Any
from unittest.mock import MagicMock
import pytest
from ramalama.command import context
@pytest.mark.parametrize(
"is_container, should_generate, dry_run",
[
(True, True, False),
(False, True, True),
(True, False, True),
(False, False, Fal... | "smollm:135m" | assert | string_literal | test/unit/command/test_context.py | test_ramalama_model_context_properties | 95 | null | |
containers/ramalama | import pytest
import ramalama.toml_parser
@pytest.mark.parametrize(
"toml, expected",
[
(
"""
[store]
container = "podman"
engine = "podman"
image = "example_image"
transport = "oci"
[store.extra]
extra_key... | expected["store"]["extra"] | assert | complex_expr | test/unit/test_toml_parser.py | test_toml_parser_get | 113 | null | |
containers/ramalama | import json
import pytest
from ramalama.benchmarks import manager, schemas
def _make_config(engine: str) -> schemas.TestConfigurationV1:
return schemas.TestConfigurationV1(
container_image="quay.io/ramalama/ramalama:latest",
container_runtime="docker",
inference_engine=engine,
run... | "host" | assert | string_literal | test/unit/test_benchmarks_manager.py | test_save_benchmark_record_writes_jsonl | 62 | null | |
containers/ramalama | import urllib.request
from unittest.mock import MagicMock, patch
import pytest
from ramalama.proxy_support import _get_proxy_env, _is_socks_proxy, get_proxy_info, setup_proxy_support
def clearenv(monkeypatch):
# Clear any proxy env vars that might exist
for var in [
'http_proxy',
'HTTP_PROXY'... | expected | assert | variable | test/unit/test_proxy_support.py | test_is_socks_proxy | TestIsSocksProxy | 95 | null |
containers/ramalama | import sys
from argparse import Namespace
from unittest import mock
import pytest
from ramalama.cli import ParsedGenerateInput, parse_generate_option, post_parse_setup
from ramalama.transports.base import NoGGUFModelFileFound, SafetensorModelNotSupported
@pytest.mark.parametrize(
"input,expected",
[
... | expected.output_dir | assert | complex_expr | test/unit/test_cli.py | test_parse_generate_option | 31 | null | |
containers/ramalama | from pathlib import Path
import pytest
from ramalama.compose import Compose, genfile
def test_genfile_empty_content(monkeypatch):
"""Test genfile with empty content."""
printed_output = []
monkeypatch.setattr("builtins.print", lambda x: printed_output.append(x))
name = "empty-service"
content = ... | "" | assert | string_literal | test/unit/test_compose.py | test_genfile_empty_content | 217 | null | |
containers/ramalama | import json
import pytest
from ramalama.chat_providers.base import ChatRequestOptions
from ramalama.chat_providers.openai import OpenAICompletionsChatProvider, OpenAIResponsesChatProvider
from ramalama.chat_utils import AssistantMessage, ImageURLPart, ToolCall, ToolMessage, UserMessage
def build_payload(content):
... | "Hi there" | assert | string_literal | test/unit/providers/test_openai_provider.py | test_streaming_handles_structured_chunks | OpenAICompletionsProviderTests | 60 | null |
containers/ramalama | import pytest
from ramalama.chat_providers.api_providers import get_chat_provider
from ramalama.chat_providers.openai import OpenAIResponsesChatProvider
def test_get_chat_provider_returns_openai_provider():
provider = get_chat_provider("openai")
assert isinstance(provider, OpenAIResponsesChatProvider)
as... | "openai" | assert | string_literal | test/unit/test_api_providers.py | test_get_chat_provider_returns_openai_provider | 12 | null | |
containers/ramalama | import os
import shutil
import subprocess
from contextlib import ExitStack
from pathlib import Path
from sys import platform
from unittest.mock import MagicMock, Mock, mock_open, patch
import pytest
from ramalama.cli import configure_subcommands, create_argument_parser, default_image, default_rag_image
from ramalama.... | expected | assert | variable | test/unit/test_common.py | test_rm_until_substring | 49 | null | |
containers/ramalama | import os
import shutil
import subprocess
from contextlib import ExitStack
from pathlib import Path
from sys import platform
from unittest.mock import MagicMock, Mock, mock_open, patch
import pytest
from ramalama.cli import configure_subcommands, create_argument_parser, default_image, default_rag_image
from ramalama.... | "cuda" | assert | string_literal | test/unit/test_common.py | test_check_nvidia_smi_success | TestCheckNvidia | 182 | null |
containers/ramalama | import sys
from contextlib import redirect_stderr, redirect_stdout
from subprocess import CalledProcessError
import pytest
def run_ramalama_direct(args):
"""Run ramalama directly via Python import to avoid installation issues"""
from ramalama.cli import main
# Save original sys.argv
original_argv = s... | str(e) | assert | func_call | test/e2e/test_cli_max_tokens.py | test_max_tokens_argument_parsing | 70 | null | |
containers/ramalama | import re
import subprocess
from subprocess import CalledProcessError
import pytest
from test.conftest import skip_if_apple_silicon, skip_if_no_mlx, skip_if_not_apple_silicon
from test.e2e.utils import RamalamaExecWorkspace, check_output
MODEL = "hf://mlx-community/Llama-3.2-1B-Instruct-4bit"
@pytest.mark.e2e
@skip... | result.lower() | assert | func_call | test/e2e/test_mlx.py | test_runtime_mlx_run_model_with_prompt | 207 | null | |
containers/ramalama | import json
import tempfile
from pathlib import Path
import pytest
from ramalama.version import version
from test.conftest import skip_if_gh_actions_darwin
from test.e2e.utils import RamalamaExecWorkspace, check_output
@pytest.mark.e2e
@pytest.mark.distro_integration
@skip_if_gh_actions_darwin
def test_info_selinux_... | False | assert | bool_literal | test/e2e/test_info.py | test_info_selinux_state | 55 | null | |
containers/ramalama | from dataclasses import dataclass, field
import pytest
from ramalama.model_store.snapshot_file import SnapshotFile
from ramalama.transports.url import URL
@pytest.mark.parametrize(
"input,expected",
[
(Input(""), Expected()),
(Input("file:///tmp/models/granite-3b-code-base.Q4_K_M.gguf"), Expe... | expected.Names[i] | assert | complex_expr | test/unit/test_url.py | test__assemble_split_file_list | 58 | null | |
containers/ramalama | import json
import os
import platform
import re
import string
from pathlib import Path
from subprocess import STDOUT, CalledProcessError
import pytest
from ramalama.version import version as ramalama_version
from test.conftest import skip_if_no_container
from test.e2e.utils import RamalamaExecWorkspace, check_output,... | "latest" | assert | string_literal | test/e2e/test_help.py | test_default_image_by_env_variable | 114 | null | |
containers/ramalama | import itertools
import json
import logging
import os
import platform
import random
import re
import string
import time
from contextlib import contextmanager
from pathlib import Path
from subprocess import STDOUT, CalledProcessError
import pytest
import yaml
from test.conftest import (
skip_if_container,
skip... | expected | assert | variable | test/e2e/test_serve.py | test_params | 225 | null | |
containers/ramalama | import socket
from argparse import Namespace
from unittest.mock import MagicMock, Mock, patch
import pytest
from ramalama.command.factory import assemble_command
from ramalama.common import MNT_DIR
from ramalama.config import get_config
from ramalama.transports.base import Transport, compute_ports, compute_serving_po... | args | assert | variable | test/unit/test_transport_base.py | test_setup_mounts_oci_docker | TestOCIModelSetupMounts | 328 | null |
containers/ramalama | import os
from unittest.mock import patch
import pytest
from ramalama.config import (
BaseConfig,
RamalamaImages,
default_config,
get_config,
get_default_engine,
get_default_store,
load_env_config,
)
from ramalama.log_levels import LogLevel
config = get_config()
def isolate_config():
... | {} | assert | collection | test/unit/test_config.py | test_load_env_config_empty_environment | TestLoadEnvConfig | 368 | null |
containers/ramalama | import json
import platform
import re
from pathlib import Path
from subprocess import STDOUT, CalledProcessError
import pytest
from test.conftest import skip_if_docker, skip_if_no_container, skip_if_podman_too_old, skip_if_windows
from test.e2e.utils import RamalamaExecWorkspace, check_output
def path_to_uri(path):
... | 0 | assert | numeric_literal | test/e2e/test_artifact.py | test_artifact_lifecycle_basic | 307 | null | |
containers/ramalama | import pytest
from ramalama.cli_arg_normalization import normalize_pull_arg
class TestNormalizePullArg:
@pytest.mark.parametrize(
"engine,pull_value",
[
("podman", "newer"),
("podman", "always"),
("podman", "missing"),
("podman", "never"),
... | pull_value | assert | variable | test/unit/test_cli_arg_normalization.py | test_non_docker_engines_are_unchanged | TestNormalizePullArg | 31 | null |
containers/ramalama | from dataclasses import dataclass, field
from typing import Any, Dict, List
from ramalama.layered_config import LayeredMixin, build_subconfigs, deep_merge, extract_defaults
def default_simple_config() -> SimpleConfig:
return SimpleConfig(name="default_simple", value=42)
def default_nested_config() -> NestedConfi... | 60 | assert | numeric_literal | test/unit/test_layered_config.py | test_layered_mixin_with_dataclass_subconfigs | TestLayeredMixin | 677 | null |
containers/ramalama | from dataclasses import dataclass
from typing import Union
import pytest
import ramalama.transports.transport_factory as transport_factory_module
from ramalama.chat_providers.openai import OpenAIResponsesChatProvider
from ramalama.transports.api import APITransport
from ramalama.transports.huggingface import Huggingf... | error) | pytest.raises | variable | test/unit/test_transport_factory.py | test_model_factory_create | 80 | null | |
containers/ramalama | import json
import pytest
from ramalama.benchmarks import manager, schemas
def _make_config(engine: str) -> schemas.TestConfigurationV1:
return schemas.TestConfigurationV1(
container_image="quay.io/ramalama/ramalama:latest",
container_runtime="docker",
inference_engine=engine,
run... | 2 | assert | numeric_literal | test/unit/test_benchmarks_manager.py | test_list_returns_saved_records_in_order | 104 | null | |
containers/ramalama | import os
import tempfile
from pathlib import Path
import pytest
from ramalama.chat_utils import ImageURLPart
from ramalama.file_loaders.file_manager import OpanAIChatAPIMessageBuilder
def _text_content(message):
return message.text or ""
def _image_parts(message):
return [attachment for attachment in messa... | 3 | assert | numeric_literal | test/unit/test_file_loader_with_data.py | test_load_multiple_image_files | TestImageUploadWithDataFiles | 270 | null |
containers/ramalama | import socket
from argparse import Namespace
from unittest.mock import MagicMock, Mock, patch
import pytest
from ramalama.command.factory import assemble_command
from ramalama.common import MNT_DIR
from ramalama.config import get_config
from ramalama.transports.base import Transport, compute_ports, compute_serving_po... | oci_model | assert | variable | test/unit/test_transport_base.py | test_setup_mounts_oci_docker | TestOCIModelSetupMounts | 327 | null |
containers/ramalama | import platform
import re
from pathlib import Path
from subprocess import STDOUT, CalledProcessError
import pytest
from ramalama.path_utils import normalize_host_path_for_container
from test.conftest import (
skip_if_docker,
skip_if_no_container,
skip_if_not_windows,
skip_if_ppc64le,
skip_if_s390x... | 22 | assert | numeric_literal | test/e2e/test_rag.py | test_rag_error_when_image_has_invalid_format | 173 | null | |
containers/ramalama | import os
from ramalama.compat import NamedTemporaryFile, StrEnum
def test_StrEnum():
class TestEnum(StrEnum):
A = "a"
B = "b"
C = "c"
assert TestEnum.A == "a"
assert TestEnum.B == | "b" | assert | string_literal | test/unit/test_compat.py | test_StrEnum | 56 | null | |
containers/ramalama | import os
import shutil
import subprocess
from contextlib import ExitStack
from pathlib import Path
from sys import platform
from unittest.mock import MagicMock, Mock, mock_open, patch
import pytest
from ramalama.cli import configure_subcommands, create_argument_parser, default_image, default_rag_image
from ramalama.... | True | assert | bool_literal | test/unit/test_common.py | test_apple_vm_returns_result | 166 | null | |
containers/ramalama | import io
import os
from pathlib import Path
from typing import Optional
import pytest
from ramalama.quadlet import Quadlet
@pytest.mark.parametrize(
"input,expected_files_path",
[
(
Input(
model_name="tinyllama",
model_src_blob="sha256-2af3b81862c6be03c769... | expected_files | assert | variable | test/unit/test_quadlet.py | test_quadlet_generate | 265 | null | |
containers/ramalama | import json
import pytest
from ramalama.benchmarks import manager, schemas
def _make_config(engine: str) -> schemas.TestConfigurationV1:
return schemas.TestConfigurationV1(
container_image="quay.io/ramalama/ramalama:latest",
container_runtime="docker",
inference_engine=engine,
run... | "model.gguf" | assert | string_literal | test/unit/test_benchmarks_manager.py | test_save_benchmark_record_writes_jsonl | 61 | null | |
containers/ramalama | import json
import pytest
from ramalama.chat_providers.base import ChatRequestOptions
from ramalama.chat_providers.openai import OpenAICompletionsChatProvider, OpenAIResponsesChatProvider
from ramalama.chat_utils import AssistantMessage, ImageURLPart, ToolCall, ToolMessage, UserMessage
def build_payload(content):
... | "hello world" | assert | string_literal | test/unit/providers/test_openai_provider.py | test_extracts_string_and_structured_deltas | OpenAICompletionsProviderTests | 41 | null |
containers/ramalama | import json
import random
import re
import string
from pathlib import Path, PurePosixPath
from subprocess import STDOUT, CalledProcessError
import pytest
from ramalama.path_utils import normalize_host_path_for_container
from test.conftest import (
skip_if_big_endian_machine,
skip_if_darwin,
skip_if_little... | pull_output | assert | variable | test/e2e/test_pull.py | test_pull_using_ollama_cache | 252 | null | |
containers/ramalama | import pytest
import ramalama.toml_parser
@pytest.mark.parametrize(
"toml, expected",
[
(
"""
[store]
container = "container_value"
engine = "engine_value"
image = "image_value"
transport = "transport_value"
""",
... | expected["store"]["engine"] | assert | complex_expr | test/unit/test_toml_parser.py | test_get_method_without_extra | 175 | null | |
containers/ramalama | import argparse
from unittest.mock import patch
import pytest
from ramalama.command.context import RamalamaArgsContext
from ramalama.config import default_config
class TestMaxTokensConfig:
def test_max_tokens_env_override(self):
"""Test that max_tokens can be set via environment variable."""
env... | True | assert | bool_literal | test/unit/test_max_tokens.py | test_max_tokens_env_override | TestMaxTokensConfig | 39 | null |
containers/ramalama | import subprocess
import tempfile
import warnings
from unittest.mock import Mock, patch
import pytest
from ramalama.arg_types import StoreArgs
from ramalama.transports.rlcr import RamalamaContainerRegistry, find_model_file_in_image
def suppress_rlcr_warnings():
"""Suppress expected warnings from RLCR model file ... | 2 | assert | numeric_literal | test/unit/test_rlcr.py | test_find_model_file_with_no_value_label | TestModelFileDiscovery | 94 | null |
containers/ramalama | import sys
from argparse import Namespace
from unittest import mock
import pytest
from ramalama.cli import ParsedGenerateInput, parse_generate_option, post_parse_setup
from ramalama.transports.base import NoGGUFModelFileFound, SafetensorModelNotSupported
@pytest.mark.parametrize(
"input,expected",
[
... | expected | assert | variable | test/unit/test_cli.py | test_parse_generate_input_str | 42 | null | |
containers/ramalama | import os
import pytest
from ramalama.common import generate_sha256_binary
from ramalama.model_store.global_store import GlobalModelStore
from ramalama.model_store.reffile import RefJSONFile, StoreFile, StoreFileType
from ramalama.model_store.snapshot_file import (
LocalSnapshotFile,
SnapshotFile,
Snapsho... | ref | assert | variable | test/unit/test_model_store.py | test_try_convert_existing_chat_template_converts_flat_jinja | 85 | null | |
containers/ramalama | import sys
from argparse import Namespace
from unittest import mock
import pytest
from ramalama.cli import ParsedGenerateInput, parse_generate_option, post_parse_setup
from ramalama.transports.base import NoGGUFModelFileFound, SafetensorModelNotSupported
@pytest.mark.parametrize(
"input,expected",
[
... | expected.gen_type | assert | complex_expr | test/unit/test_cli.py | test_parse_generate_option | 30 | null | |
containers/ramalama | import os
from unittest.mock import patch
import pytest
from ramalama.config import (
BaseConfig,
RamalamaImages,
default_config,
get_config,
get_default_engine,
get_default_store,
load_env_config,
)
from ramalama.log_levels import LogLevel
config = get_config()
def isolate_config():
... | 4 | assert | numeric_literal | test/unit/test_config.py | test_config_multiple_env_layers | TestConfigIntegration | 582 | null |
containers/ramalama | import argparse
from unittest.mock import patch
import pytest
from ramalama.command.context import RamalamaArgsContext
from ramalama.config import default_config
class TestMaxTokensCLI:
def test_max_tokens_cli_invalid_value(self):
"""Test that --max-tokens rejects invalid values."""
parser = arg... | SystemExit) | pytest.raises | variable | test/unit/test_max_tokens.py | test_max_tokens_cli_invalid_value | TestMaxTokensCLI | 130 | null |
containers/ramalama | from dataclasses import dataclass, field
import pytest
from ramalama.model_store.snapshot_file import SnapshotFile
from ramalama.transports.url import URL
@pytest.mark.parametrize(
"input,expected",
[
(Input(""), Expected()),
(Input("file:///tmp/models/granite-3b-code-base.Q4_K_M.gguf"), Expe... | expected.URLList[i] | assert | complex_expr | test/unit/test_url.py | test__assemble_split_file_list | 57 | null | |
containers/ramalama | import argparse
from typing import Any
from unittest.mock import MagicMock
import pytest
from ramalama.command import context
@pytest.mark.parametrize(
"is_container, should_generate, dry_run",
[
(True, True, False),
(False, True, True),
(True, False, True),
(False, False, Fal... | dry_run) | assert_* | variable | test/unit/command/test_context.py | test_ramalama_model_context_properties | 102 | null | |
containers/ramalama | import json
import pytest
from ramalama.benchmarks import manager, schemas
def _make_config(engine: str) -> schemas.TestConfigurationV1:
return schemas.TestConfigurationV1(
container_image="quay.io/ramalama/ramalama:latest",
container_runtime="docker",
inference_engine=engine,
run... | [] | assert | collection | test/unit/test_benchmarks_manager.py | test_list_empty_returns_empty_list | 70 | null | |
containers/ramalama | import os
from ramalama.compat import NamedTemporaryFile, StrEnum
def test_StrEnum():
class TestEnum(StrEnum):
A = "a"
B = "b"
C = "c"
assert TestEnum.A == | "a" | assert | string_literal | test/unit/test_compat.py | test_StrEnum | 55 | null | |
containers/ramalama | import random
import re
from pathlib import Path
from subprocess import STDOUT, CalledProcessError
import pytest
from test.e2e.utils import RamalamaExecWorkspace, check_output
@pytest.mark.e2e
def test_delete_non_existing_image():
image_name = f"rm_random_image_{random.randint(0, 9999)}"
with pytest.raises(C... | 22 | assert | numeric_literal | test/e2e/test_rm.py | test_delete_non_existing_image | 17 | null | |
containers/ramalama | import os
import pytest
from ramalama.common import generate_sha256_binary
from ramalama.model_store.global_store import GlobalModelStore
from ramalama.model_store.reffile import RefJSONFile, StoreFile, StoreFileType
from ramalama.model_store.snapshot_file import (
LocalSnapshotFile,
SnapshotFile,
Snapsho... | Exception) | pytest.raises | variable | test/unit/test_model_store.py | test_model_factory_create | 36 | null | |
containers/ramalama | import json
import pytest
from ramalama.chat_providers.base import ChatRequestOptions
from ramalama.chat_providers.openai import OpenAICompletionsChatProvider, OpenAIResponsesChatProvider
from ramalama.chat_utils import AssistantMessage, ImageURLPart, ToolCall, ToolMessage, UserMessage
def build_payload(content):
... | [] | assert | collection | test/unit/providers/test_openai_provider.py | test_streaming_ignores_invalid_json_chunks | OpenAIResponsesProviderTests | 134 | null |
containers/ramalama | import os
from unittest.mock import patch
import pytest
from ramalama.config import (
BaseConfig,
RamalamaImages,
default_config,
get_config,
get_default_engine,
get_default_store,
load_env_config,
)
from ramalama.log_levels import LogLevel
config = get_config()
def isolate_config():
... | [] | assert | collection | test/unit/test_config.py | test_correct_config_defaults | 42 | null | |
containers/ramalama | import json
import re
from subprocess import STDOUT, CalledProcessError
import pytest
from test.e2e.utils import RamalamaExecWorkspace
GGUF_MODEL = "ollama://tinyllama"
ST_MODEL = "https://huggingface.co/LiheYoung/depth-anything-small-hf/resolve/main/model.safetensors"
def shared_ctx():
with RamalamaExecWorkspa... | 22 | assert | numeric_literal | test/e2e/test_inspect.py | test_inspect_non_existent_model | 27 | null | |
containers/ramalama | import urllib.request
from unittest.mock import MagicMock, patch
import pytest
from ramalama.proxy_support import _get_proxy_env, _is_socks_proxy, get_proxy_info, setup_proxy_support
def clearenv(monkeypatch):
# Clear any proxy env vars that might exist
for var in [
'http_proxy',
'HTTP_PROXY'... | None | assert | none_literal | test/unit/test_proxy_support.py | test_proxy_handler_installed | TestProxyIntegration | 227 | null |
containers/ramalama | import os
import pytest
from ramalama.common import generate_sha256_binary
from ramalama.model_store.global_store import GlobalModelStore
from ramalama.model_store.reffile import RefJSONFile, StoreFile, StoreFileType
from ramalama.model_store.snapshot_file import (
LocalSnapshotFile,
SnapshotFile,
Snapsho... | 1 | assert | numeric_literal | test/unit/test_model_store.py | test_try_convert_existing_chat_template_converts_flat_jinja | 87 | null | |
containers/ramalama | import json
import pytest
from ramalama.chat_providers.base import ChatRequestOptions
from ramalama.chat_providers.openai import OpenAICompletionsChatProvider, OpenAIResponsesChatProvider
from ramalama.chat_utils import AssistantMessage, ImageURLPart, ToolCall, ToolMessage, UserMessage
def build_payload(content):
... | True | assert | bool_literal | test/unit/providers/test_openai_provider.py | test_streaming_emits_delta_and_completion_events | OpenAIResponsesProviderTests | 111 | null |
containers/ramalama | import unittest
from argparse import Namespace
from http.client import HTTPException
from json import JSONDecodeError
from subprocess import TimeoutExpired
from unittest.mock import Mock, patch
import pytest
import ramalama.engine
@pytest.mark.parametrize(
"status, ok",
[
(500, False),
(404, ... | ok | assert | variable | test/unit/test_engine.py | test_is_healthy_vllm | 208 | null | |
containers/ramalama | import os
import tempfile
from unittest.mock import MagicMock, patch
import pytest
from ramalama.chat import RamaLamaShell, chat
from ramalama.chat_utils import ImageURLPart
def _text_content(message):
return message.text or ""
class TestFileUploadChatIntegration:
@patch('urllib.request.urlopen')
def t... | 1 | assert | numeric_literal | test/unit/test_file_loader_integration.py | test_chat_with_file_input_single_file | TestFileUploadChatIntegration | 38 | null |
containers/ramalama | import os
import pytest
from ramalama.common import generate_sha256_binary
from ramalama.model_store.global_store import GlobalModelStore
from ramalama.model_store.reffile import RefJSONFile, StoreFile, StoreFileType
from ramalama.model_store.snapshot_file import (
LocalSnapshotFile,
SnapshotFile,
Snapsho... | SnapshotFileType.ChatTemplate | assert | complex_expr | test/unit/test_model_store.py | test_try_convert_existing_chat_template_converts_flat_jinja | 89 | null | |
containers/ramalama | from types import SimpleNamespace
from unittest import mock
import pytest
from ramalama.chat_providers.openai import OpenAIResponsesChatProvider
from ramalama.config import get_config
from ramalama.transports import api as api_module
from ramalama.transports.api import APITransport
CONFIG = get_config()
def make_pr... | "cli-secret" | assert | string_literal | test/unit/test_api_transport.py | test_api_transport_overrides_provider_api_key | 81 | null | |
containers/ramalama | import json
import os
import platform
import re
import string
from pathlib import Path
from subprocess import STDOUT, CalledProcessError
import pytest
from ramalama.version import version as ramalama_version
from test.conftest import skip_if_no_container
from test.e2e.utils import RamalamaExecWorkspace, check_output,... | ['podman', 'docker'] | assert | collection | test/e2e/test_help.py | test_default_container_engine | 156 | null | |
containers/ramalama | import json
import platform
import re
from pathlib import Path
from subprocess import STDOUT, CalledProcessError
import pytest
from test.conftest import skip_if_docker, skip_if_no_container, skip_if_podman_too_old, skip_if_windows
from test.e2e.utils import RamalamaExecWorkspace, check_output
def path_to_uri(path):
... | 1 | assert | numeric_literal | test/e2e/test_artifact.py | test_artifact_overwrite_same_name | 571 | null | |
containers/ramalama | import json
import tempfile
from pathlib import Path
import pytest
from ramalama.version import version
from test.conftest import skip_if_gh_actions_darwin
from test.e2e.utils import RamalamaExecWorkspace, check_output
@pytest.mark.e2e
@pytest.mark.distro_integration
@skip_if_gh_actions_darwin
def test_info(monkeypa... | version() | assert | func_call | test/e2e/test_info.py | test_info | 21 | null | |
containers/ramalama | import json
import platform
import re
from pathlib import Path
from subprocess import STDOUT, CalledProcessError
import pytest
from test.conftest import skip_if_docker, skip_if_no_container, skip_if_podman_too_old, skip_if_windows
from test.e2e.utils import RamalamaExecWorkspace, check_output
def path_to_uri(path):
... | None | assert | none_literal | test/e2e/test_artifact.py | test_list_command | 45 | null | |
containers/ramalama | import os
import shutil
import subprocess
from contextlib import ExitStack
from pathlib import Path
from sys import platform
from unittest.mock import MagicMock, Mock, mock_open, patch
import pytest
from ramalama.cli import configure_subcommands, create_argument_parser, default_image, default_rag_image
from ramalama.... | set(names) | assert | func_call | test/unit/test_common.py | test_load_cdi_config | 376 | null | |
containers/ramalama | import json
import tempfile
from pathlib import Path
import pytest
from ramalama.version import version
from test.conftest import skip_if_gh_actions_darwin
from test.e2e.utils import RamalamaExecWorkspace, check_output
@pytest.mark.e2e
@pytest.mark.distro_integration
@skip_if_gh_actions_darwin
def test_info_selinux_... | True | assert | bool_literal | test/e2e/test_info.py | test_info_selinux_state | 64 | null | |
containers/ramalama | from dataclasses import dataclass, field
from typing import Any, Dict, List
from ramalama.layered_config import LayeredMixin, build_subconfigs, deep_merge, extract_defaults
def default_simple_config() -> SimpleConfig:
return SimpleConfig(name="default_simple", value=42)
def default_nested_config() -> NestedConfi... | 2 | assert | numeric_literal | test/unit/test_layered_config.py | test_layered_mixin_reverse_order_processing | TestLayeredMixin | 651 | null |
containers/ramalama | import json
import platform
import re
import shutil
from pathlib import Path
from subprocess import DEVNULL, PIPE, STDOUT, CalledProcessError
import pytest
from test.conftest import (
skip_if_container,
skip_if_darwin,
skip_if_docker,
skip_if_gh_actions_darwin,
skip_if_no_container,
skip_if_no... | expected | assert | variable | test/e2e/test_run.py | test_params | 233 | null | |
containers/ramalama | import json
import pytest
from ramalama.chat_providers.base import ChatRequestOptions
from ramalama.chat_providers.openai import OpenAICompletionsChatProvider, OpenAIResponsesChatProvider
from ramalama.chat_utils import AssistantMessage, ImageURLPart, ToolCall, ToolMessage, UserMessage
def build_payload(content):
... | ValueError) | pytest.raises | variable | test/unit/providers/test_openai_provider.py | test_rejects_attachments | OpenAICompletionsProviderTests | 65 | null |
containers/ramalama | import json
import pytest
from ramalama.benchmarks import manager, schemas
def _make_config(engine: str) -> schemas.TestConfigurationV1:
return schemas.TestConfigurationV1(
container_image="quay.io/ramalama/ramalama:latest",
container_runtime="docker",
inference_engine=engine,
run... | "engine-a" | assert | string_literal | test/unit/test_benchmarks_manager.py | test_list_returns_saved_records_in_order | 105 | null | |
containers/ramalama | import json
import random
import re
import string
from pathlib import Path, PurePosixPath
from subprocess import STDOUT, CalledProcessError
import pytest
from ramalama.path_utils import normalize_host_path_for_container
from test.conftest import (
skip_if_big_endian_machine,
skip_if_darwin,
skip_if_little... | 2 | assert | numeric_literal | test/e2e/test_pull.py | test_pull_no_model | 27 | null | |
containers/ramalama | from pathlib import Path
import pytest
from ramalama.compose import Compose, genfile
def test_compose_no_port_arg(monkeypatch):
"""Test Compose generation when the args object has no 'port' attribute."""
class ArgsNoPort:
def __init__(self):
self.image = "test-image"
self.rag... | result | assert | variable | test/unit/test_compose.py | test_compose_no_port_arg | 239 | null | |
containers/ramalama | import os
import shutil
import subprocess
from contextlib import ExitStack
from pathlib import Path
from sys import platform
from unittest.mock import MagicMock, Mock, mock_open, patch
import pytest
from ramalama.cli import configure_subcommands, create_argument_parser, default_image, default_rag_image
from ramalama.... | 3 | assert | numeric_literal | test/unit/test_common.py | test_populate_volume_success | TestPopulateVolumeFromImage | 449 | null |
containers/ramalama | import subprocess
import tempfile
import warnings
from unittest.mock import Mock, patch
import pytest
from ramalama.arg_types import StoreArgs
from ramalama.transports.rlcr import RamalamaContainerRegistry, find_model_file_in_image
def suppress_rlcr_warnings():
"""Suppress expected warnings from RLCR model file ... | None | assert | none_literal | test/unit/test_rlcr.py | test_find_model_file_label_fails | TestModelFileDiscovery | 103 | null |
containers/ramalama | import os
import pytest
from ramalama.common import generate_sha256_binary
from ramalama.model_store.global_store import GlobalModelStore
from ramalama.model_store.reffile import RefJSONFile, StoreFile, StoreFileType
from ramalama.model_store.snapshot_file import (
LocalSnapshotFile,
SnapshotFile,
Snapsho... | True | assert | bool_literal | test/unit/test_model_store.py | test_try_convert_existing_chat_template_converts_flat_jinja | 84 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.