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
spylang/spy
import re import pytest from spy.errors import SPyError from spy.tests.support import CompilerTest, skip_backends class TestDynamic(CompilerTest): def test_upcast_and_downcast(self): # this is similar to the same test in test_basic, but it uses # `dynamic` instead of `object` mod = self.c...
1
assert
numeric_literal
spy/tests/compiler/test_dynamic.py
test_upcast_and_downcast
TestDynamic
20
null
spylang/spy
import textwrap from spy.location import Loc from spy.vm.b import OP, B from spy.vm.function import W_FuncType from spy.vm.object import W_Object from spy.vm.opimpl import ArgSpec, W_OpImpl from spy.vm.primitive import W_I32 from spy.vm.str import W_Str from spy.vm.vm import SPyVM def make_w_repeat(vm: "SPyVM"): ...
r
assert
variable
spy/tests/vm/test_opimpl.py
test_shuffle_args
39
null
spylang/spy
from math import isclose, isnan import pytest from spy.errors import SPyError from spy.tests.support import CompilerTest def int_type(request): return request.param class TestUnsafeIntDiv(CompilerTest): def test_unchecked_floordiv(self, int_type): mod = self.compile(f""" from unsafe import ...
3
assert
numeric_literal
spy/tests/compiler/unsafe/test_div.py
test_unchecked_floordiv
TestUnsafeIntDiv
40
null
spylang/spy
from contextlib import contextmanager from typing import TYPE_CHECKING, Any, Optional from spy.errfmt import Level from spy.location import Loc def get_pyclass(etype: str) -> type["W_Exception"]: """ Perform a lazy lookup of app-level exception classes. Example: get_pyclass('W_TypeError') --> spy...
None
assert
none_literal
spy/errors.py
add_traceback
SPyError
58
null
spylang/spy
import pytest from spy.errors import SPyError from spy.fqn import FQN from spy.tests.support import CompilerTest, expect_errors, only_interp from spy.tests.wasm_wrapper import WasmPtr from spy.vm.b import B from spy.vm.modules.unsafe import UNSAFE from spy.vm.object import W_Type from spy.vm.registry import ModuleRegi...
di
assert
variable
spy/tests/compiler/test_struct.py
test_dir
TestStructOnStack
351
null
spylang/spy
import pytest from spy.errors import SPyError from spy.tests.support import CompilerTest, expect_errors, only_C, only_interp from spy.tests.wasm_wrapper import WasmPtr from spy.vm.b import B from spy.vm.modules.unsafe import UNSAFE from spy.vm.modules.unsafe.ptr import W_Ptr def memkind(request): return request.p...
3
assert
numeric_literal
spy/tests/compiler/unsafe/test_ptr.py
test_can_allocate_ptr
TestUnsafePtr
332
null
spylang/spy
import pytest from spy.errors import SPyError from spy.tests.support import CompilerTest def int_type(request): return request.param class TestInt(CompilerTest): def test_binop(self, int_type): mod = self.compile(f""" T = {int_type} def add(x: T, y: T) -> T: return x + y ...
4
assert
numeric_literal
spy/tests/compiler/test_int.py
test_binop
TestInt
75
null
spylang/spy
import textwrap from typing import Any import pytest from spy import ast from spy.ast_dump import dump from spy.parser import Parser from spy.tests.support import MatchAnnotation, expect_errors from spy.util import print_diff class TestParser: def init(self, tmpdir): self.tmpdir = tmpdir def parse(...
"-100"
assert
string_literal
spy/tests/test_parser.py
test_negative_const
TestParser
769
null
spylang/spy
from math import isclose, isnan import pytest from spy.errors import SPyError from spy.tests.support import CompilerTest def int_type(request): return request.param class TestUnsafeIntDiv(CompilerTest): def test_unchecked_floordiv(self, int_type): mod = self.compile(f""" from unsafe import ...
0
assert
numeric_literal
spy/tests/compiler/unsafe/test_div.py
test_unchecked_floordiv
TestUnsafeIntDiv
42
null
spylang/spy
import re from spy.errors import SPyError from spy.tests.support import CompilerTest, skip_backends class TestStr(CompilerTest): def test_getitem(self): mod = self.compile(""" def foo(a: str, i: i32) -> str: return a[i] """) assert mod.foo("ABCDE", 0) ==
"A"
assert
string_literal
spy/tests/compiler/test_str.py
test_getitem
TestStr
60
null
spylang/spy
import pytest from spy.tests.support import CompilerTest class TestRange(CompilerTest): def test_misc(self): src = """ from _range import range def tostr(r: range) -> str: s = '' for i in r: s += str(i) + ' ' return s def fmt1(...
""
assert
string_literal
spy/tests/stdlib/test__range.py
test_misc
TestRange
92
null
spylang/spy
from spy.backend.c.c_ast import BinOp, Literal, UnaryOp, make_table from spy.backend.c.context import C_Ident def test_C_Ident(): assert str(C_Ident("hello")) ==
"hello"
assert
string_literal
spy/tests/test_backend_c.py
test_C_Ident
81
null
spylang/spy
from spy.fqn import FQN from spy.tests.support import CompilerTest, only_interp from spy.vm.b import B from spy.vm.modules.__spy__.interp_dict import W_InterpDict from spy.vm.object import W_Type class TestDict(CompilerTest): @only_interp def test_type_as_both_dict_key_and_value(self): src = """ ...
B.w_str
assert
complex_expr
spy/tests/compiler/test_dict.py
test_type_as_both_dict_key_and_value
TestDict
122
null
spylang/spy
from typing import Any from spy.tests.support import CompilerTest, no_C from spy.vm.builtin import builtin_method from spy.vm.opspec import W_MetaArg, W_OpSpec from spy.vm.primitive import W_I32 from spy.vm.registry import ModuleRegistry from spy.vm.vm import SPyVM from spy.vm.w import W_Object class TestOperatorBino...
9
assert
numeric_literal
spy/tests/compiler/operator/test_binop.py
test_add
TestOperatorBinop
175
null
spylang/spy
import textwrap import py.path import pytest from spy import ast from spy.analyze import importing from spy.analyze.importing import SPYC_VERSION, ImportAnalyzer from spy.vm.vm import SPyVM class TestImportAnalyzer: def init(self, tmpdir): self.vm = SPyVM() self.vm.path = [str(tmpdir)] s...
None
assert
none_literal
spy/tests/test_import_analyzer.py
test_missing_module
TestImportAnalyzer
107
null
spylang/spy
import pytest from spy.tests.support import CompilerTest class TestTange(CompilerTest): def test_len(self): mod = self.compile(""" from _tuple import tuple def foo() -> i32: tup = tuple[int, int, str](1, 2, 'hello') return len(tup) """) x = mod.foo...
3
assert
numeric_literal
spy/tests/stdlib/test__tuple.py
test_len
TestTange
41
null
spylang/spy
import textwrap import pytest from spy.textbuilder import ColorFormatter, TextBuilder class TestTextBuilder: def test_lineno(self): b = TextBuilder() assert b.lineno == 1 b.wl("one") assert b.lineno == 2 b.wb(""" two three four """) ...
5
assert
numeric_literal
spy/tests/test_textbuilder.py
test_lineno
TestTextBuilder
172
null
spylang/spy
import textwrap from spy.ast_dump import dump from spy.magic_py_parse import magic_py_parse, preprocess from spy.parser import Parser from spy.tests.support import expect_errors def test_magic_py_parse(): src = textwrap.dedent(""" var x: i32 = 100 const y: i32 = 200 z: i32 = 300 """) py_mod =...
expected.strip()
assert
func_call
spy/tests/test_magic_py_parse.py
test_magic_py_parse
81
null
spylang/spy
import struct from spy.libspy import LLSPyInstance, SPyError from spy.llwasm import LLWasmModule from spy.tests.support import CTest def mk_spy_Str(utf8: bytes) -> bytes: """ Return the spy_Str representation of the given utf8 bytes. For example, for b'hello' we have the following in-memory repr: ...
p2
assert
variable
spy/tests/test_libspy.py
test_walloc
TestLibSPy
41
null
spylang/spy
import textwrap import py.path import pytest from spy import ast from spy.analyze import importing from spy.analyze.importing import SPYC_VERSION, ImportAnalyzer from spy.vm.vm import SPyVM class TestImportAnalyzer: def init(self, tmpdir): self.vm = SPyVM() self.vm.path = [str(tmpdir)] s...
["aaa"]
assert
collection
spy/tests/test_import_analyzer.py
test_duplicate_imports_deduplicated
TestImportAnalyzer
309
null
spylang/spy
from spy.fqn import FQN, NSPart def test_FQN_join(): a = FQN("a") b = a.join("b") assert b.fullname ==
"a::b"
assert
string_literal
spy/tests/test_fqn.py
test_FQN_join
64
null
spylang/spy
import re from spy.errors import SPyError from spy.tests.support import CompilerTest, skip_backends class TestStr(CompilerTest): def test_str_fallback_to_repr(self): # str() should fallback to repr() for types without custom __str__ src = """ def str_blue() -> str: return str(...
mod.repr_blue()
assert
func_call
spy/tests/compiler/test_str.py
test_str_fallback_to_repr
TestStr
174
null
spylang/spy
import textwrap import pytest from spy.backend.spy import FQN_FORMAT, SPyBackend from spy.util import print_diff from spy.vm.vm import SPyVM class TestDoppler: def init(self, tmpdir): # XXX there is a lot of code duplication with CompilerTest self.tmpdir = tmpdir self.vm = SPyVM() ...
1
assert
numeric_literal
spy/tests/test_doppler.py
test_ast_color_map_populated
TestDoppler
375
null
spylang/spy
import re import pytest from spy.errors import SPyError from spy.tests.support import CompilerTest, skip_backends class TestDynamic(CompilerTest): def test_bitwise(self): mod = self.compile(""" def shl(x: dynamic, y: dynamic) -> dynamic: return x << y def shr(x: dynamic, y: dynamic) ->...
2 << 5
assert
complex_expr
spy/tests/compiler/test_dynamic.py
test_bitwise
TestDynamic
88
null
spylang/spy
from spy.fqn import FQN from spy.tests.support import CompilerTest, only_interp from spy.vm.b import B from spy.vm.modules.__spy__.interp_dict import W_InterpDict from spy.vm.object import W_Type class TestDict(CompilerTest): @only_interp def test_literal_interp_dict(self): mod = self.compile(""" ...
1
assert
numeric_literal
spy/tests/compiler/test_dict.py
test_literal_interp_dict
TestDict
53
null
spylang/spy
import pytest from spy.errors import SPyError from spy.fqn import FQN from spy.tests.support import CompilerTest, expect_errors, only_interp from spy.tests.wasm_wrapper import WasmPtr from spy.vm.b import B from spy.vm.modules.unsafe import UNSAFE from spy.vm.object import W_Type from spy.vm.registry import ModuleRegi...
9
assert
numeric_literal
spy/tests/compiler/test_struct.py
test_staticmethod
TestStructOnStack
458
null
spylang/spy
import pytest from spy.fqn import FQN from spy.tests.support import CompilerTest, no_C from spy.vm.b import B from spy.vm.modules.__spy__.interp_dict import W_InterpDictType class TestInterpDict(CompilerTest): def test_len(self): mod = self.compile(""" from __spy__ import interp_dict def...
3
assert
numeric_literal
spy/tests/compiler/__spy__/test_interp_dict.py
test_len
TestInterpDict
74
null
spylang/spy
import pytest from spy.tests.support import CompilerTest class TestRange(CompilerTest): def test_fastiter(self): src = """ from _range import range, range_iterator def get_iter() -> range_iterator: r = range(3) return r.__fastiter__() def next(it: range_i...
2
assert
numeric_literal
spy/tests/stdlib/test__range.py
test_fastiter
TestRange
51
null
spylang/spy
from spy.tests.support import CompilerTest, expect_errors, only_interp class TestImporting(CompilerTest): SKIP_SPY_BACKEND_SANITY_CHECK = True def test_implicit_imports(self): mod = self.compile(""" def foo() -> i32: result: i32 = 0 for x in range(3): re...
3
assert
numeric_literal
spy/tests/compiler/test_importing.py
test_implicit_imports
TestImporting
214
null
spylang/spy
from spy.fqn_parser import FQN, tokenize def test_nested_qualifiers(): fqn = FQN("dict[str, unsafe::ptr[i32]]") assert len(fqn.parts) == 1 assert fqn.parts[0].name == "dict" assert len(fqn.parts[0].qualifiers) == 2 assert fqn.parts[0].qualifiers[0].parts[0].name ==
"str"
assert
string_literal
spy/tests/test_fqn_parser.py
test_nested_qualifiers
50
null
spylang/spy
from textwrap import dedent from spy.tests.support import CompilerTest, only_interp from spy.vm.struct import UnwrappedStruct class TestSlice(CompilerTest): def test__slice_indices(self): # This test is a bit of a workaround for the fact that we cannot easily # have SPy functions which accept eit...
out
assert
variable
spy/tests/stdlib/test__slice.py
test__slice_indices
TestSlice
84
null
spylang/spy
import pytest from spy.errors import SPyError from spy.fqn import FQN from spy.tests.support import ( CompilerTest, expect_errors, no_C, only_interp, skip_backends, ) from spy.vm.b import B class TestMetaFunc(CompilerTest): @no_C def test_STATIC_TYPE_side_effects(self): if self.ba...
0
assert
numeric_literal
spy/tests/compiler/test_metafunc.py
test_STATIC_TYPE_side_effects
TestMetaFunc
119
null
spylang/spy
import re from spy.errors import SPyError from spy.tests.support import CompilerTest, skip_backends class TestStr(CompilerTest): def test_str_none(self): src = """ def foo() -> str: return str(None) """ mod = self.compile(src) assert mod.foo() ==
"None"
assert
string_literal
spy/tests/compiler/test_str.py
test_str_none
TestStr
182
null
redis/redis-py
from datetime import datetime import warnings import pytest from redis.utils import ( compare_versions, deprecated_function, deprecated_args, experimental_method, experimental_args, ) def redis_server_time(client): seconds, milliseconds = client.time() timestamp = float(f"{seconds}.{millise...
0
assert
numeric_literal
tests/test_utils.py
test_sync_function_no_warning_on_allowed_arg
TestDeprecatedArgs
95
null
redis/redis-py
import socket from redis.retry import Retry from redis.sentinel import SentinelManagedConnection from redis.backoff import NoBackoff from unittest import mock def test_connect_retry_on_timeout_error(master_host): """Test that the _connect function is retried in case of a timeout""" connection_pool = mock.Mock...
3
assert
numeric_literal
tests/test_sentinel_managed_connection.py
test_connect_retry_on_timeout_error
32
null
redis/redis-py
import bz2 import csv import os import random import time from io import TextIOWrapper import numpy as np import pytest from redis import ResponseError import redis import redis.commands.search.aggregation as aggregations from redis.commands.search.hybrid_query import ( CombinationMethods, CombineResultsMetho...
6
assert
numeric_literal
tests/test_search.py
test_svs_vamana_vector_field_basic
TestSearchWithVamana
3,330
null
redis/redis-py
from time import sleep from unittest.mock import Mock import pytest from redis.multidb.command_executor import SyncCommandExecutor from redis.multidb.database import Database from redis.multidb.failure_detector import CommandFailureDetector from redis.multidb.circuit import State as CBState from redis.exceptions impo...
CBState.OPEN
assert
complex_expr
tests/test_multidb/test_failure_detector.py
test_failure_detector_do_not_open_circuit_on_interval_exceed
TestCommandFailureDetector
94
null
redis/redis-py
from unittest.mock import patch import pytest from redis.asyncio.retry import Retry as AsyncRetry from redis.backoff import ( AbstractBackoff, ConstantBackoff, DecorrelatedJitterBackoff, EqualJitterBackoff, ExponentialBackoff, ExponentialWithJitterBackoff, FullJitterBackoff, NoBackoff, ...
retries + 1
assert
complex_expr
tests/test_retry.py
test_client_retry_on_error_raise
TestRedisClientRetry
213
null
redis/redis-py
from unittest.mock import patch import pytest from redis.asyncio.retry import Retry as AsyncRetry from redis.backoff import ( AbstractBackoff, ConstantBackoff, DecorrelatedJitterBackoff, EqualJitterBackoff, ExponentialBackoff, ExponentialWithJitterBackoff, FullJitterBackoff, NoBackoff, ...
retries
assert
variable
tests/test_retry.py
test_retry_on_timeout_retry
TestConnectionConstructorWithRetry
59
null
redis/redis-py
import contextlib import multiprocessing import platform import pytest import redis from redis.connection import Connection, ConnectionPool from redis.exceptions import ConnectionError from .conftest import _get_client def exit_callback(callback, *args): try: yield finally: callback(*args) c...
1
assert
numeric_literal
tests/test_multiprocessing.py
target
TestMultiprocessing
123
null
redis/redis-py
import bz2 import csv import os import random import time from io import TextIOWrapper import numpy as np import pytest from redis import ResponseError import redis import redis.commands.search.aggregation as aggregations from redis.commands.search.hybrid_query import ( CombinationMethods, CombineResultsMetho...
0
assert
numeric_literal
tests/test_search.py
test_client
TestBaseSearchFunctionality
196
null
redis/redis-py
import json import random import numpy as np import pytest import redis from redis.commands.vectorset.commands import QuantizationOptions from .conftest import ( _get_client, skip_if_server_version_lt, ) def d_client(request): r = _get_client(redis.Redis, request, decode_responses=True) r.flushdb() ...
0
assert
numeric_literal
tests/test_vsets.py
test_vsim_with_filter
430
null
redis/redis-py
from unittest import mock from unittest.mock import MagicMock import pytest import redis from redis.event import ( EventDispatcher, ) from redis.observability import recorder from redis.observability.config import OTelConfig, MetricGroup from redis.observability.metrics import RedisMetricsCollector class TestRed...
"GET"
assert
string_literal
tests/test_client.py
test_get_command_records_metrics
TestRedisClientMetricsRecording
167
null
redis/redis-py
import json import random import numpy as np import pytest import redis from redis.commands.vectorset.commands import QuantizationOptions from .conftest import ( _get_client, skip_if_server_version_lt, ) def d_client(request): r = _get_client(redis.Redis, request, decode_responses=True) r.flushdb() ...
5
assert
numeric_literal
tests/test_vsets.py
test_vsim_count
232
null
redis/redis-py
import time from time import sleep import pytest import pytest_asyncio import redis.asyncio as redis from tests.conftest import ( assert_resp_response, is_resp2_connection, skip_if_server_version_gte, skip_if_server_version_lt, skip_ifmodversion_lt, ) async def decoded_r(create_redis, stack_url): ...
["2"])
assert_*
collection
tests/test_asyncio/test_timeseries.py
test_query_index
787
null
redis/redis-py
import threading from typing import Tuple from unittest.mock import patch, Mock import pytest from redis.exceptions import ResponseError import redis from redis import CrossSlotTransactionError, ConnectionPool, RedisClusterException from redis.backoff import NoBackoff from redis.client import Redis from redis.cluster...
b"4"
assert
string_literal
tests/test_cluster_transaction.py
test_transaction_callable
TestClusterTransaction
397
null
redis/redis-py
import copy import platform import socket import sys import threading import types from errno import ECONNREFUSED from typing import Any from unittest import mock from unittest.mock import call, patch, MagicMock, Mock import pytest import redis from redis import ConnectionPool, Redis from redis._parsers import _Hiredi...
0
assert
numeric_literal
tests/test_connection.py
test_connection_parse_response_resume
213
null
redis/redis-py
from datetime import datetime import warnings import pytest from redis.utils import ( compare_versions, deprecated_function, deprecated_args, experimental_method, experimental_args, ) def redis_server_time(client): seconds, milliseconds = client.time() timestamp = float(f"{seconds}.{millise...
1
assert
numeric_literal
tests/test_utils.py
test_sync_function_warns
TestDeprecatedFunction
55
null
redis/redis-py
from math import inf import pytest import pytest_asyncio import redis.asyncio as redis from redis.exceptions import RedisError from tests.conftest import ( assert_resp_response, is_resp2_connection, skip_ifmodversion_lt, ) async def decoded_r(create_redis, stack_url): return await create_redis(decode_...
info["k"]
assert
complex_expr
tests/test_asyncio/test_bloom.py
test_topk
330
null
redis/redis-py
import time from unittest.mock import MagicMock import pytest import redis from redis.cache import ( CacheConfig, CacheEntry, CacheEntryStatus, CacheKey, CacheProxy, DefaultCache, EvictionPolicy, EvictionPolicyType, LRUPolicy, ) from redis.event import ( EventDispatcher, ) from...
1
assert
numeric_literal
tests/test_cache.py
test_delete_by_cache_keys_removes_associated_entries
TestUnitDefaultCache
1,210
null
redis/redis-py
import pytest import redis from redis import exceptions from redis.commands.core import Script from tests.conftest import skip_if_redis_enterprise, skip_if_server_version_lt multiply_script = """ local value = redis.call('GET', KEYS[1]) value = tonumber(value) return value * ARGV[1]""" msgpack_hello_script = """ loca...
True
assert
bool_literal
tests/test_scripting.py
test_flush_response
TestScripting
185
null
redis/redis-py
import socket import threading from typing import List, Union from unittest.mock import patch import pytest from time import sleep from redis import Redis from redis.cache import CacheConfig from redis.connection import ( AbstractConnection, Connection, ConnectionPool, BlockingConnectionPool, Main...
conn
assert
variable
tests/maint_notifications/test_maint_notifications_handling.py
_validate_connection_handlers
TestMaintenanceNotificationsHandlingSingleProxy
543
null
redis/redis-py
from unittest.mock import patch import pytest from redis.asyncio.retry import Retry as AsyncRetry from redis.backoff import ( AbstractBackoff, ConstantBackoff, DecorrelatedJitterBackoff, EqualJitterBackoff, ExponentialBackoff, ExponentialWithJitterBackoff, FullJitterBackoff, NoBackoff, ...
1 + retries
assert
complex_expr
tests/test_retry.py
test_retry
TestRetry
164
null
redis/redis-py
import functools import random import string import threading from time import sleep from typing import Optional, Tuple, Union from unittest.mock import Mock, call import pytest import redis from redis import AuthenticationError, DataError, Redis, ResponseError from redis.auth.err import RequestTokenErr from redis.bac...
True
assert
bool_literal
tests/test_credentials.py
init_acl_user
95
null
redis/redis-py
import pytest from .conftest import ( skip_if_redis_enterprise, skip_ifnot_redis_enterprise, wait_for_command, ) class TestMonitor: def test_response_values(self, r): db = r.connection_pool.connection_kwargs.get("db", 0) with r.monitor() as m: r.ping() response...
db
assert
variable
tests/test_monitor.py
test_response_values
TestMonitor
24
null
redis/redis-py
from time import sleep import pytest from redis.data_structure import WeightedList from redis.multidb.circuit import State as CBState from redis.multidb.exception import ( NoValidDatabaseException, TemporaryUnavailableException, ) from redis.multidb.failover import ( WeightBasedFailoverStrategy, Defau...
mock_db
assert
variable
tests/test_multidb/test_failover.py
test_execute_returns_valid_database_with_failover_attempts
TestDefaultStrategyExecutor
94
null
redis/redis-py
import asyncio import socket import types from unittest import mock from errno import ECONNREFUSED from unittest.mock import patch import pytest import redis from redis._parsers import ( _AsyncHiredisParser, _AsyncRESP2Parser, _AsyncRESP3Parser, _AsyncRESPBase, ) from redis.asyncio import ConnectionPoo...
inner
assert
variable
tests/test_asyncio/test_connection.py
test_loading_external_modules
107
null
redis/redis-py
from concurrent.futures import ThreadPoolExecutor import json import logging import random from queue import Queue from threading import Thread import threading import time from typing import Any, Dict, List, Literal, Optional, Union import pytest from redis import Redis from redis.connection import ConnectionInterfa...
conn.host
assert
complex_expr
tests/test_scenario/test_maint_notifications.py
test_old_connection_shutdown_during_moving
TestStandaloneClientPushNotifications
849
null
redis/redis-py
import asyncio import re from unittest import mock import pytest import pytest_asyncio import redis.asyncio as redis from redis.asyncio.connection import Connection, to_bool from redis.auth.token import TokenInterface from tests.conftest import skip_if_redis_enterprise, skip_if_server_version_lt from .compat import a...
diff
assert
variable
tests/test_asyncio/test_connection_pool.py
assert_interval_advanced
TestHealthCheck
820
null
redis/redis-py
from contextlib import closing from unittest import mock import pytest from redis import RedisClusterException import redis from redis.client import Pipeline from redis.observability import recorder from redis.observability.config import OTelConfig, MetricGroup from redis.observability.metrics import RedisMetricsColle...
b"4"
assert
string_literal
tests/test_pipeline.py
test_transaction_callable
TestPipeline
336
null
redis/redis-py
from unittest import mock import pytest from redis import RedisClusterException import redis from tests.conftest import skip_if_server_version_lt from .compat import aclosing from .conftest import wait_for_command class TestPipeline: @pytest.mark.onlynoncluster async def test_transaction_callable(self, r): ...
b"4"
assert
string_literal
tests/test_asyncio/test_pipeline.py
test_transaction_callable
TestPipeline
333
null
redis/redis-py
import pytest from redis._parsers import CommandsParser from redis._parsers.commands import RequestPolicy, ResponsePolicy from tests.helpers import get_expected_command_policies from .conftest import ( assert_resp_response, skip_if_redis_enterprise, skip_if_server_version_gte, skip_if_server_version_lt...
None
assert
none_literal
tests/test_command_parser.py
test_init_commands
TestCommandsParser
17
null
redis/redis-py
import os import re import time from contextlib import closing from threading import Thread from unittest import mock from unittest.mock import MagicMock import pytest import redis from redis.cache import CacheConfig from redis.connection import CacheProxyConnection, Connection, to_bool from redis.event import ( A...
True
assert
bool_literal
tests/test_connection_pool.py
test_cert_reqs_options
TestSSLConnectionURLParsing
579
null
redis/redis-py
import threading from typing import Tuple from unittest.mock import patch, Mock import pytest from redis.exceptions import ResponseError import redis from redis import CrossSlotTransactionError, ConnectionPool, RedisClusterException from redis.backoff import NoBackoff from redis.client import Redis from redis.cluster...
attrs
assert
variable
tests/test_cluster_transaction.py
test_transaction_server_attributes_recorded
TestClusterTransactionMetricsRecording
527
null
redis/redis-py
from math import inf import pytest import redis.commands.bf from redis.exceptions import RedisError from .conftest import ( _get_client, assert_resp_response, is_resp2_connection, skip_ifmodversion_lt, ) def decoded_r(request, stack_url): with _get_client( redis.Redis, request, decode_res...
res[0]
assert
complex_expr
tests/test_bloom.py
test_tdigest_quantile
474
null
redis/redis-py
import bz2 import csv import os import random import time from io import TextIOWrapper import numpy as np import pytest from redis import ResponseError import redis import redis.commands.search.aggregation as aggregations from redis.commands.search.hybrid_query import ( CombinationMethods, CombineResultsMetho...
2
assert
numeric_literal
tests/test_search.py
test_expire
TestBaseSearchFunctionality
1,082
null
redis/redis-py
import pytest from tests.conftest import skip_if_redis_enterprise, skip_ifnot_redis_enterprise from .conftest import wait_for_command class TestMonitor: @skip_if_redis_enterprise() async def test_lua_script(self, r): async with r.monitor() as m: script = 'return redis.call("GET", "foo")' ...
""
assert
string_literal
tests/test_asyncio/test_monitor.py
test_lua_script
TestMonitor
56
null
redis/redis-py
from unittest import mock from unittest.mock import MagicMock import pytest import redis from redis.event import ( EventDispatcher, ) from redis.observability import recorder from redis.observability.config import OTelConfig, MetricGroup from redis.observability.metrics import RedisMetricsCollector class TestRed...
2
assert
numeric_literal
tests/test_client.py
test_retry_exhausted_records_final_error_metrics
TestRedisClientMetricsRecording
501
null
redis/redis-py
from math import inf import pytest import redis.commands.bf from redis.exceptions import RedisError from .conftest import ( _get_client, assert_resp_response, is_resp2_connection, skip_ifmodversion_lt, ) def decoded_r(request, stack_url): with _get_client( redis.Redis, request, decode_res...
info["depth"]
assert
complex_expr
tests/test_bloom.py
test_cms
265
null
redis/redis-py
import platform import queue import socket import threading import time from collections import defaultdict from unittest import mock from unittest.mock import patch import pytest import redis from redis.client import PubSub from redis.event import EventDispatcher from redis.exceptions import ConnectionError from redi...
3
assert
numeric_literal
tests/test_pubsub.py
test_pubsub_numpat
TestPubSubSubcommands
901
null
redis/redis-py
import json import random import numpy as np import pytest import redis from redis.commands.vectorset.commands import QuantizationOptions from .conftest import ( _get_client, skip_if_server_version_lt, ) def d_client(request): r = _get_client(redis.Redis, request, decode_responses=True) r.flushdb() ...
8
assert
numeric_literal
tests/test_vsets.py
test_add_elem_with_numlinks
210
null
redis/redis-py
import threading from typing import Tuple from unittest.mock import patch, Mock import pytest from redis.exceptions import ResponseError import redis from redis import CrossSlotTransactionError, ConnectionPool, RedisClusterException from redis.backoff import NoBackoff from redis.client import Redis from redis.cluster...
1
assert
numeric_literal
tests/test_cluster_transaction.py
test_watch_command_records_metric
TestClusterTransactionMetricsRecording
658
null
redis/redis-py
from unittest.mock import Mock, AsyncMock from redis.event import ( EventListenerInterface, EventDispatcher, AsyncEventListenerInterface, ) class TestEventDispatcher: def test_register_listeners(self): mock_event = Mock(spec=object) mock_event_listener = Mock(spec=EventListenerInterfac...
3
assert
numeric_literal
tests/test_event.py
test_register_listeners
TestEventDispatcher
38
null
redis/redis-py
import threading from unittest.mock import patch, Mock import pybreaker import pytest from redis.client import Pipeline from redis.multidb.circuit import State as CBState, PBCircuitBreakerAdapter from redis.multidb.client import MultiDBClient from redis.multidb.config import InitialHealthCheck from redis.multidb.fail...
CBState.OPEN
assert
complex_expr
tests/test_multidb/test_pipeline.py
test_execute_pipeline_against_correct_db_and_closed_circuit
TestPipeline
120
null
redis/redis-py
from contextlib import closing from unittest import mock import pytest from redis import RedisClusterException import redis from redis.client import Pipeline from redis.observability import recorder from redis.observability.config import OTelConfig, MetricGroup from redis.observability.metrics import RedisMetricsColle...
0
assert
numeric_literal
tests/test_pipeline.py
test_pipeline_execute_records_metric
TestPipelineMetricsRecording
589
null
redis/redis-py
import asyncio from time import sleep import pytest from redis.background import BackgroundScheduler class TestBackgroundScheduler: def callback(arg1: str, arg2: int): nonlocal execute_counter nonlocal one nonlocal two execute_counter += 1 asser...
one
assert
variable
tests/test_background.py
callback
TestBackgroundScheduler
22
null
redis/redis-py
import pytest import redis from .conftest import _get_client class TestEncodingErrors: def test_ignore(self, request): r = _get_client( redis.Redis, request=request, decode_responses=True, encoding_errors="ignore", ) r.set("a", b"foo\xff") ...
"foo"
assert
string_literal
tests/test_encoding.py
test_ignore
TestEncodingErrors
63
null
redis/redis-py
import pytest from redis._parsers import CommandsParser from redis._parsers.commands import RequestPolicy, ResponsePolicy from tests.helpers import get_expected_command_policies from .conftest import ( assert_resp_response, skip_if_redis_enterprise, skip_if_server_version_gte, skip_if_server_version_lt...
["*"]
assert
collection
tests/test_command_parser.py
test_get_pubsub_keys
TestCommandsParser
110
null
redis/redis-py
import time from unittest.mock import MagicMock import pytest import redis from redis.cache import ( CacheConfig, CacheEntry, CacheEntryStatus, CacheKey, CacheProxy, DefaultCache, EvictionPolicy, EvictionPolicyType, LRUPolicy, ) from redis.event import ( EventDispatcher, ) from...
0
assert
numeric_literal
tests/test_cache.py
test_cache_clears_on_disconnect
TestCache
265
null
redis/redis-py
from unittest import mock from unittest.mock import MagicMock import pytest import redis from redis.event import ( EventDispatcher, ) from redis.observability import recorder from redis.observability.config import OTelConfig, MetricGroup from redis.observability.metrics import RedisMetricsCollector class TestRed...
0
assert
numeric_literal
tests/test_client.py
test_execute_command_records_metrics
TestRedisClientMetricsRecording
130
null
redis/redis-py
import math import time from time import sleep import pytest import redis from .conftest import ( _get_client, assert_resp_response, is_resp2_connection, skip_if_server_version_gte, skip_if_server_version_lt, skip_ifmodversion_lt, ) def decoded_r(request, stack_url): with _get_client( ...
len(res)
assert
func_call
tests/test_timeseries.py
test_mrange
562
null
redis/redis-py
import socket from unittest import mock import pytest from redis.client import StrictRedis import redis.sentinel from redis import exceptions from redis.sentinel import ( MasterNotFoundError, Sentinel, SentinelConnectionPool, SlaveNotFoundError, ) from tests.conftest import is_resp2_connection def ma...
True
assert
bool_literal
tests/test_sentinel.py
test_ckquorum
265
null
redis/redis-py
import time import pytest from redis.client import Redis from redis.exceptions import LockError, LockNotOwnedError from redis.lock import Lock from .conftest import _get_client class TestLock: def r_decoded(self, request): return _get_client(Redis, request=request, decode_responses=True) def get_lo...
"foo"
assert
string_literal
tests/test_lock.py
test_lock_error_gives_correct_lock_name
TestLock
277
null
redis/redis-py
import pytest import redis from redis import Redis, exceptions from redis.commands.json.decoders import decode_list, unstring from redis.commands.json.path import Path from .conftest import _get_client, assert_resp_response, skip_ifmodversion_lt def client(request, stack_url): r = _get_client(Redis, request, deco...
2
assert
numeric_literal
tests/test_json.py
test_json_delete_with_dollar
349
null
redis/redis-py
from math import inf import pytest import redis.commands.bf from redis.exceptions import RedisError from .conftest import ( _get_client, assert_resp_response, is_resp2_connection, skip_ifmodversion_lt, ) def decoded_r(request, stack_url): with _get_client( redis.Redis, request, decode_res...
info["k"]
assert
complex_expr
tests/test_bloom.py
test_topk
361
null
redis/redis-py
from unittest.mock import patch import pytest from redis.asyncio.retry import Retry as AsyncRetry from redis.backoff import ( AbstractBackoff, ConstantBackoff, DecorrelatedJitterBackoff, EqualJitterBackoff, ExponentialBackoff, ExponentialWithJitterBackoff, FullJitterBackoff, NoBackoff, ...
1
assert
numeric_literal
tests/test_retry.py
test_retry_on_error
TestConnectionConstructorWithRetry
66
null
redis/redis-py
import string from redis.commands.helpers import ( delist, list_or_args, nativestr, parse_to_list, random_string, ) def test_nativestr(): assert nativestr("teststr") == "teststr" assert nativestr(b"teststr") == "teststr" assert nativestr("null") is
None
assert
none_literal
tests/test_helpers.py
test_nativestr
30
null
redis/redis-py
import binascii import datetime import re import threading import time from asyncio import CancelledError from string import ascii_letters from unittest import mock from unittest.mock import patch import pytest from redis import DataError, RedisClusterException, ResponseError import redis from redis import exceptions ...
3
assert
numeric_literal
tests/test_commands.py
test_acl_log
TestRedisCommands
454
null
redis/redis-py
import pytest from redis.driver_info import DriverInfo from redis.utils import get_lib_version def test_driver_info_default_name_no_upstream(): info = DriverInfo() assert info.formatted_name == "redis-py" assert info.upstream_drivers ==
[]
assert
collection
tests/test_driver_info.py
test_driver_info_default_name_no_upstream
10
null
redis/redis-py
import time import pytest from redis.client import Redis from redis.exceptions import LockError, LockNotOwnedError from redis.lock import Lock from .conftest import _get_client class TestLock: def r_decoded(self, request): return _get_client(Redis, request=request, decode_responses=True) def get_lo...
True
assert
bool_literal
tests/test_lock.py
test_locked
TestLock
49
null
redis/redis-py
import pybreaker import pytest from redis.multidb.circuit import ( PBCircuitBreakerAdapter, State as CbState, CircuitBreaker, ) class TestPBCircuitBreaker: @pytest.mark.parametrize( "mock_db", [ {"weight": 0.7, "circuit": {"state": CbState.CLOSED}}, ], indir...
CbState.OPEN
assert
complex_expr
tests/test_multidb/test_circuit.py
test_cb_correctly_configured
TestPBCircuitBreaker
26
null
redis/redis-py
import pytest from .conftest import ( skip_if_redis_enterprise, skip_ifnot_redis_enterprise, wait_for_command, ) class TestMonitor: @skip_if_redis_enterprise() def test_lua_script(self, r): with r.monitor() as m: script = 'return redis.call("GET", "foo")' assert r....
""
assert
string_literal
tests/test_monitor.py
test_lua_script
TestMonitor
59
null
redis/redis-py
import pytest from tests.conftest import skip_if_redis_enterprise, skip_ifnot_redis_enterprise from .conftest import wait_for_command class TestMonitor: async def test_response_values(self, r): db = r.connection_pool.connection_kwargs.get("db", 0) async with r.monitor() as m: await r....
db
assert
variable
tests/test_asyncio/test_monitor.py
test_response_values
TestMonitor
21
null
redis/redis-py
from contextlib import closing from unittest import mock import pytest from redis import RedisClusterException import redis from redis.client import Pipeline from redis.observability import recorder from redis.observability.config import OTelConfig, MetricGroup from redis.observability.metrics import RedisMetricsColle...
3
assert
numeric_literal
tests/test_pipeline.py
test_pipeline_length
TestPipeline
50
null
redis/redis-py
import math import time from time import sleep import pytest import redis from .conftest import ( _get_client, assert_resp_response, is_resp2_connection, skip_if_server_version_gte, skip_if_server_version_lt, skip_ifmodversion_lt, ) def decoded_r(request, stack_url): with _get_client( ...
str(e)
assert
func_call
tests/test_timeseries.py
test_del_range
247
null
redis/redis-py
from unittest import mock from unittest.mock import MagicMock import pytest import redis from redis.event import ( EventDispatcher, ) from redis.observability import recorder from redis.observability.config import OTelConfig, MetricGroup from redis.observability.metrics import RedisMetricsCollector class TestRed...
"5"
assert
string_literal
tests/test_client.py
test_different_db_namespace_recorded
TestRedisClientMetricsRecording
316
null
redis/redis-py
import functools import random import string from asyncio import Lock as AsyncLock from asyncio import sleep as async_sleep from typing import Optional, Tuple, Union from unittest.mock import AsyncMock, call import pytest import pytest_asyncio import redis from redis import AuthenticationError, DataError, RedisError, ...
""
assert
string_literal
tests/test_asyncio/test_credentials.py
test_user_pass_provider_only_password
TestUsernamePasswordCredentialProvider
316
null
redis/redis-py
import pytest import redis from redis import Redis, exceptions from redis.commands.json.decoders import decode_list, unstring from redis.commands.json.path import Path from .conftest import _get_client, assert_resp_response, skip_ifmodversion_lt def client(request, stack_url): r = _get_client(Redis, request, deco...
6
assert
numeric_literal
tests/test_json.py
test_arrappend_dollar
637
null
redis/redis-py
import re import socket import socketserver import ssl import threading import pytest from redis.connection import Connection, SSLConnection, UnixDomainSocketConnection from redis.exceptions import RedisError from .ssl_utils import CertificateType, get_tls_certificates _CLIENT_NAME = "test-suite-client" _CMD_SEP = b...
""
assert
string_literal
tests/test_connect.py
test_unix_socket_with_timeout
123
null
redis/redis-py
import pytest import redis from redis import Redis, exceptions from redis.commands.json.decoders import decode_list, unstring from redis.commands.json.path import Path from .conftest import _get_client, assert_resp_response, skip_ifmodversion_lt def client(request, stack_url): r = _get_client(Redis, request, deco...
1
assert
numeric_literal
tests/test_json.py
test_json_setgetdeleteforget
30
null