Datasets:
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 |
|---|---|---|---|---|---|---|---|---|---|
michaelhly/solana-py | from unittest.mock import patch
import pytest
from httpx import ReadTimeout
from solders.commitment_config import CommitmentLevel
from solders.pubkey import Pubkey
from solders.rpc.config import RpcSignaturesForAddressConfig
from solders.rpc.requests import GetSignaturesForAddress
from solders.signature import Signatu... | SolanaRpcException) | pytest.raises | variable | tests/unit/test_client.py | test_client_http_exception | 22 | null | |
michaelhly/solana-py | from typing import AsyncGenerator, List, Tuple
import asyncstdlib
import pytest
from solders import system_program as sp
from solders.keypair import Keypair
from solders.message import Message
from solders.pubkey import Pubkey
from solders.rpc.config import RpcTransactionLogsFilter, RpcTransactionLogsFilterMentions
fr... | owned.pubkey() | assert | func_call | tests/integration/test_websockets.py | test_program_subscribe | 297 | null | |
michaelhly/solana-py | from typing import Tuple
import pytest
import solders.system_program as sp
from solders.keypair import Keypair
from solders.message import MessageV0, Message
from solders.pubkey import Pubkey
from solders.rpc.errors import SendTransactionPreflightFailureMessage
from solders.rpc.requests import GetBlockHeight, GetFirst... | None | assert | none_literal | tests/integration/test_http_client.py | test_send_raw_transaction_and_get_balance | 182 | null | |
michaelhly/solana-py | import pytest
from solana.utils.security_txt import NoSecurityTxtFoundError, parse_security_txt
def test_parse_wrong_data_type():
"""Test parsing security txt string instead of bytes."""
wrong_type = "test"
with pytest.raises( | TypeError) | pytest.raises | variable | tests/unit/test_security_txt.py | test_parse_wrong_data_type | 28 | null | |
michaelhly/solana-py | import pytest
import spl.token._layouts as layouts
from solders.pubkey import Pubkey
from spl.token.async_client import AsyncToken
from spl.token.constants import ASSOCIATED_TOKEN_PROGRAM_ID, TOKEN_PROGRAM_ID
from ..utils import AIRDROP_AMOUNT, OPTS, assert_valid_response
@pytest.mark.integration
@pytest.fixture(scop... | 0 | assert | numeric_literal | tests/integration/test_async_token_client.py | test_token | 42 | null | |
michaelhly/solana-py | from solana.utils.cluster import cluster_api_url
def test_input_output():
"""Test that cluster_api_url generates the expected output."""
assert cluster_api_url() == "https://api.devnet.solana.com"
assert cluster_api_url("devnet") == "https://api.devnet.solana.com"
assert cluster_api_url("devnet", True)... | "http://api.devnet.solana.com" | assert | string_literal | tests/unit/test_cluster_api_url.py | test_input_output | 11 | null | |
michaelhly/solana-py | import spl.token.instructions as spl_token
from solders.pubkey import Pubkey
from solders.system_program import ID as SYSTEM_PROGRAM_ID
from spl.token.constants import TOKEN_PROGRAM_ID, WRAPPED_SOL_MINT, ASSOCIATED_TOKEN_PROGRAM_ID
from spl.token.instructions import get_associated_token_address
def test_create_idempot... | 1 | assert | numeric_literal | tests/unit/test_spl_token_instructions.py | test_create_idempotent_token_account | 507 | null | |
michaelhly/solana-py | from typing import Tuple
import pytest
import solders.system_program as sp
from solders.keypair import Keypair
from solders.message import MessageV0, Message
from solders.pubkey import Pubkey
from solders.rpc.errors import SendTransactionPreflightFailureMessage
from solders.rpc.requests import GetBlockHeight, GetFirst... | resp) | assert_* | variable | tests/integration/test_async_http_client.py | test_request_air_drop | 33 | null | |
michaelhly/solana-py | from unittest.mock import patch
import pytest
from httpx import ReadTimeout
from solders.commitment_config import CommitmentLevel
from solders.pubkey import Pubkey
from solders.rpc.config import RpcSignaturesForAddressConfig
from solders.rpc.requests import GetSignaturesForAddress
from solders.signature import Signatu... | actual | assert | variable | tests/unit/test_client.py | test_client_address_sig_args_no_commitment | 39 | null | |
michaelhly/solana-py | import spl.token.instructions as spl_token
from solders.pubkey import Pubkey
from solders.system_program import ID as SYSTEM_PROGRAM_ID
from spl.token.constants import TOKEN_PROGRAM_ID, WRAPPED_SOL_MINT, ASSOCIATED_TOKEN_PROGRAM_ID
from spl.token.instructions import get_associated_token_address
def test_create_idempot... | 6 | assert | numeric_literal | tests/unit/test_spl_token_instructions.py | test_create_idempotent_token_account | 508 | null | |
michaelhly/solana-py | from unittest.mock import patch
import pytest
from httpx import ReadTimeout
from solders.commitment_config import CommitmentLevel
from solders.pubkey import Pubkey
from solders.rpc.config import RpcSignaturesForAddressConfig
from solders.rpc.requests import GetSignaturesForAddress
from solders.signature import Signatu... | "<class 'httpx.ReadTimeout'> raised in \"GetEpochInfo\" endpoint request" | assert | string_literal | tests/unit/test_async_client.py | test_async_client_http_exception | 25 | null | |
michaelhly/solana-py | from solders.keypair import Keypair
from spl.memo.constants import MEMO_PROGRAM_ID
from spl.memo.instructions import MemoParams, create_memo, decode_create_memo
def test_memo():
"""Test creating a memo instruction."""
params = MemoParams(signer=Keypair().pubkey(), message=b"test", program_id=MEMO_PROGRAM_ID)
... | params | assert | variable | tests/unit/test_memo_program.py | test_memo | 9 | null | |
michaelhly/solana-py | from typing import get_args
from solders.rpc.responses import RPCError, RPCResult
from solana.rpc.commitment import Processed
from solana.rpc.types import TxOpts
AIRDROP_AMOUNT = 10_000_000_000
RPC_RESULT_TYPES = get_args(RPCResult)
def assert_valid_response(resp: RPCResult):
"""Assert valid RPCResult."""
... | RPC_RESULT_TYPES | assert | variable | tests/utils.py | assert_valid_response | 17 | null | |
michaelhly/solana-py | import pytest
import spl.token._layouts as layouts
from solders.pubkey import Pubkey
from spl.token.async_client import AsyncToken
from spl.token.constants import ASSOCIATED_TOKEN_PROGRAM_ID, TOKEN_PROGRAM_ID
from ..utils import AIRDROP_AMOUNT, OPTS, assert_valid_response
@pytest.mark.integration
@pytest.fixture(scop... | resp) | assert_* | variable | tests/integration/test_async_token_client.py | test_token | 19 | null | |
michaelhly/solana-py | from solana.utils.cluster import cluster_api_url
def test_input_output():
"""Test that cluster_api_url generates the expected output."""
assert cluster_api_url() == | "https://api.devnet.solana.com" | assert | string_literal | tests/unit/test_cluster_api_url.py | test_input_output | 8 | null | |
michaelhly/solana-py | import asyncio
import time
from typing import NamedTuple
import pytest
from solders.hash import Hash as Blockhash
from solders.keypair import Keypair
from solders.pubkey import Pubkey
from solana.rpc.api import Client
from solana.rpc.async_api import AsyncClient
from solana.rpc.commitment import Processed
from tests.... | AIRDROP_AMOUNT | assert | variable | tests/conftest.py | random_funded_keypair | 162 | null | |
michaelhly/solana-py | import spl.token.instructions as spl_token
from solders.pubkey import Pubkey
from solders.system_program import ID as SYSTEM_PROGRAM_ID
from spl.token.constants import TOKEN_PROGRAM_ID, WRAPPED_SOL_MINT, ASSOCIATED_TOKEN_PROGRAM_ID
from spl.token.instructions import get_associated_token_address
def test_create_idempot... | mint | assert | variable | tests/unit/test_spl_token_instructions.py | test_create_idempotent_token_account | 518 | null | |
michaelhly/solana-py | import pytest
from solana.utils.security_txt import NoSecurityTxtFoundError, parse_security_txt
def test_parse_invalid_security_text():
"""Test parsing security txt with invalid bytes."""
invalid_data = b"test"
with pytest.raises( | NoSecurityTxtFoundError) | pytest.raises | variable | tests/unit/test_security_txt.py | test_parse_invalid_security_text | 21 | null | |
michaelhly/solana-py | import asyncio
import time
from typing import NamedTuple
import pytest
from solders.hash import Hash as Blockhash
from solders.keypair import Keypair
from solders.pubkey import Pubkey
from solana.rpc.api import Client
from solana.rpc.async_api import AsyncClient
from solana.rpc.commitment import Processed
from tests.... | resp) | assert_* | variable | tests/conftest.py | random_funded_keypair | 159 | null | |
michaelhly/solana-py | from typing import AsyncGenerator, List, Tuple
import asyncstdlib
import pytest
from solders import system_program as sp
from solders.keypair import Keypair
from solders.message import Message
from solders.pubkey import Pubkey
from solders.rpc.config import RpcTransactionLogsFilter, RpcTransactionLogsFilterMentions
fr... | "Program 11111111111111111111111111111111 invoke [1]" | assert | string_literal | tests/integration/test_websockets.py | test_logs_subscribe | 251 | null | |
michaelhly/solana-py | import pytest
import spl.token._layouts as layouts
from solders.pubkey import Pubkey
from spl.token.async_client import AsyncToken
from spl.token.constants import ASSOCIATED_TOKEN_PROGRAM_ID, TOKEN_PROGRAM_ID
from ..utils import AIRDROP_AMOUNT, OPTS, assert_valid_response
async def stubbed_sender_token_account_pk(stu... | 2 | assert | numeric_literal | tests/integration/test_async_token_client.py | test_get_accounts | 270 | null | |
michaelhly/solana-py | import pytest
import spl.token._layouts as layouts
from solders.pubkey import Pubkey
from spl.token.client import Token
from spl.token.constants import ASSOCIATED_TOKEN_PROGRAM_ID, TOKEN_PROGRAM_ID
from ..utils import AIRDROP_AMOUNT, OPTS, assert_valid_response
def stubbed_sender_token_account_pk(stubbed_sender, test... | 2 | assert | numeric_literal | tests/integration/test_token_client.py | test_get_accounts | 262 | null | |
michaelhly/solana-py | from unittest.mock import patch
import pytest
from httpx import ReadTimeout
from solders.commitment_config import CommitmentLevel
from solders.pubkey import Pubkey
from solders.rpc.config import RpcSignaturesForAddressConfig
from solders.rpc.requests import GetSignaturesForAddress
from solders.signature import Signatu... | SolanaRpcException | assert | variable | tests/unit/test_client.py | test_client_http_exception | 24 | null | |
michaelhly/solana-py | import pytest
import spl.token._layouts as layouts
from solders.pubkey import Pubkey
from spl.token.client import Token
from spl.token.constants import ASSOCIATED_TOKEN_PROGRAM_ID, TOKEN_PROGRAM_ID
from ..utils import AIRDROP_AMOUNT, OPTS, assert_valid_response
@pytest.mark.integration
@pytest.fixture(scope="module")... | resp) | assert_* | variable | tests/integration/test_token_client.py | test_token | 36 | null | |
michaelhly/solana-py | import base64
from solders.hash import Hash
from solders.keypair import Keypair
from solders.message import Message
from solders.pubkey import Pubkey
import solana.vote_program as vp
def test_withdraw_from_vote_account():
withdrawer_keypair = Keypair.from_bytes(
[
134,
123,
... | js_wire_msg | assert | variable | tests/unit/test_vote_program.py | test_withdraw_from_vote_account | 114 | null | |
michaelhly/solana-py | import pytest
import spl.token._layouts as layouts
from solders.pubkey import Pubkey
from spl.token.client import Token
from spl.token.constants import ASSOCIATED_TOKEN_PROGRAM_ID, TOKEN_PROGRAM_ID
from ..utils import AIRDROP_AMOUNT, OPTS, assert_valid_response
def stubbed_sender_token_account_pk(stubbed_sender, test... | None | assert | none_literal | tests/integration/test_token_client.py | test_get_account_info | 104 | null | |
michaelhly/solana-py | import pytest
import spl.token._layouts as layouts
from solders.pubkey import Pubkey
from spl.token.client import Token
from spl.token.constants import ASSOCIATED_TOKEN_PROGRAM_ID, TOKEN_PROGRAM_ID
from ..utils import AIRDROP_AMOUNT, OPTS, assert_valid_response
@pytest.mark.integration
@pytest.fixture(scope="module")... | 0 | assert | numeric_literal | tests/integration/test_token_client.py | test_token | 42 | null | |
michaelhly/solana-py | import pytest
import spl.token._layouts as layouts
from solders.pubkey import Pubkey
from spl.token.async_client import AsyncToken
from spl.token.constants import ASSOCIATED_TOKEN_PROGRAM_ID, TOKEN_PROGRAM_ID
from ..utils import AIRDROP_AMOUNT, OPTS, assert_valid_response
async def stubbed_sender_token_account_pk(stu... | None | assert | none_literal | tests/integration/test_async_token_client.py | test_get_account_info | 107 | null | |
michaelhly/solana-py | from unittest.mock import patch
import pytest
from httpx import ReadTimeout
from solders.commitment_config import CommitmentLevel
from solders.pubkey import Pubkey
from solders.rpc.config import RpcSignaturesForAddressConfig
from solders.rpc.requests import GetSignaturesForAddress
from solders.signature import Signatu... | SolanaRpcException | assert | variable | tests/unit/test_async_client.py | test_async_client_http_exception | 24 | null | |
michaelhly/solana-py | from typing import AsyncGenerator, List, Tuple
import asyncstdlib
import pytest
from solders import system_program as sp
from solders.keypair import Keypair
from solders.message import Message
from solders.pubkey import Pubkey
from solders.rpc.config import RpcTransactionLogsFilter, RpcTransactionLogsFilterMentions
fr... | AIRDROP_AMOUNT | assert | variable | tests/integration/test_websockets.py | test_multiple_subscriptions | 224 | null | |
michaelhly/solana-py | import pytest
import spl.token._layouts as layouts
from solders.pubkey import Pubkey
from spl.token.async_client import AsyncToken
from spl.token.constants import ASSOCIATED_TOKEN_PROGRAM_ID, TOKEN_PROGRAM_ID
from ..utils import AIRDROP_AMOUNT, OPTS, assert_valid_response
async def stubbed_sender_token_account_pk(stu... | True | assert | bool_literal | tests/integration/test_async_token_client.py | test_get_account_info | 103 | null | |
michaelhly/solana-py | import pytest
import spl.token._layouts as layouts
from solders.pubkey import Pubkey
from spl.token.async_client import AsyncToken
from spl.token.constants import ASSOCIATED_TOKEN_PROGRAM_ID, TOKEN_PROGRAM_ID
from ..utils import AIRDROP_AMOUNT, OPTS, assert_valid_response
async def stubbed_sender_token_account_pk(stu... | 6 | assert | numeric_literal | tests/integration/test_async_token_client.py | test_get_mint_info | 121 | null | |
michaelhly/solana-py | import pytest
from solders.keypair import Keypair
from solders.message import Message
from solders.transaction_status import ParsedInstruction
from spl.memo.constants import MEMO_PROGRAM_ID
from spl.memo.instructions import MemoParams, create_memo
from solana.rpc.api import Client
from solana.rpc.commitment import Fin... | None | assert | none_literal | tests/integration/test_memo.py | test_send_memo_in_transaction | 42 | null | |
michaelhly/solana-py | import time
from pytest import fixture, mark
from ..utils import assert_valid_response
def _wait_until_ready() -> None:
"""Sleep for a minute so that performance samples are available."""
time.sleep(60)
@mark.integration
@mark.asyncio
async def test_get_recent_performance_samples_async(test_http_client_asyn... | resp) | assert_* | variable | tests/integration/test_recent_performance_samples.py | test_get_recent_performance_samples_async | 21 | null | |
michaelhly/solana-py | import pytest
from solders.keypair import Keypair
from solders.message import Message
from solders.transaction_status import ParsedInstruction
from spl.memo.constants import MEMO_PROGRAM_ID
from spl.memo.instructions import MemoParams, create_memo
from solana.rpc.api import Client
from solana.rpc.commitment import Fin... | raw_message | assert | variable | tests/integration/test_memo.py | test_send_memo_in_transaction | 49 | null | |
michaelhly/solana-py | import spl.token.instructions as spl_token
from solders.pubkey import Pubkey
from solders.system_program import ID as SYSTEM_PROGRAM_ID
from spl.token.constants import TOKEN_PROGRAM_ID, WRAPPED_SOL_MINT, ASSOCIATED_TOKEN_PROGRAM_ID
from spl.token.instructions import get_associated_token_address
def test_initialize_acc... | params | assert | variable | tests/unit/test_spl_token_instructions.py | test_initialize_account | 70 | null | |
michaelhly/solana-py | from unittest.mock import patch
import pytest
from httpx import ReadTimeout
from solders.commitment_config import CommitmentLevel
from solders.pubkey import Pubkey
from solders.rpc.config import RpcSignaturesForAddressConfig
from solders.rpc.requests import GetSignaturesForAddress
from solders.signature import Signatu... | SolanaRpcException) | pytest.raises | variable | tests/unit/test_async_client.py | test_async_client_http_exception | 22 | null | |
michaelhly/solana-py | from unittest.mock import patch
import pytest
from httpx import ReadTimeout
from solders.commitment_config import CommitmentLevel
from solders.pubkey import Pubkey
from solders.rpc.config import RpcSignaturesForAddressConfig
from solders.rpc.requests import GetSignaturesForAddress
from solders.signature import Signatu... | actual | assert | variable | tests/unit/test_async_client.py | test_client_address_sig_args_no_commitment | 39 | null | |
jazzband/django-axes | from unittest.mock import patch
from django.test import override_settings
from axes import __version__
from axes.apps import AppConfig
from axes.models import AccessAttempt, AccessLog
from tests.base import AxesTestCase
_BEGIN = "AXES: BEGIN version %s, %s"
_VERSION = __version__
class AppsTestCase(AxesTestCase):
... | "blocking by ip_address") | assert_* | string_literal | tests/test_logging.py | test_axes_config_log_ip_only | AppsTestCase | 43 | null |
jazzband/django-axes | from platform import python_implementation
from unittest.mock import MagicMock, patch
from datetime import datetime, timezone as dt_timezone
from django.test import override_settings
from django.utils import timezone
from axes.handlers.database import AxesDatabaseHandler
from axes.models import AccessAttempt, AccessLog... | 1) | self.assertEqual | numeric_literal | tests/test_handlers.py | test_handler_reset_attempts_ip_and_username | ResetAttemptsTestCase | 205 | null |
jazzband/django-axes | from unittest.mock import patch, MagicMock
from axes.backends import AxesBackend
from axes.exceptions import (
AxesBackendRequestParameterRequired,
AxesBackendPermissionDenied,
)
from tests.base import AxesTestCase
class BackendTestCase(AxesTestCase):
@patch("axes.handlers.proxy.AxesProxyHandler.is_allow... | AxesBackendPermissionDenied) | self.assertRaises | variable | tests/test_backends.py | test_authenticate_raises_on_locked_request | BackendTestCase | 22 | null |
jazzband/django-axes | from platform import python_implementation
from unittest.mock import MagicMock, patch
from datetime import datetime, timezone as dt_timezone
from django.test import override_settings
from django.utils import timezone
from axes.handlers.database import AxesDatabaseHandler
from axes.models import AccessAttempt, AccessLog... | 2) | self.assertEqual | numeric_literal | tests/test_handlers.py | test_handler_reset_attempts_ip_or_username | ResetAttemptsTestCase | 228 | null |
jazzband/django-axes | from axes.models import AccessFailureLog
from tests.base import AxesTestCase
from axes.helpers import get_failure_limit
from django.test import override_settings
class FailureLogTestCase(AxesTestCase):
def test_failure_log(self):
self.login(is_valid_username=True, is_valid_password=False)
self.asse... | AccessFailureLog.objects.filter(username=self.VALID_USERNAME).exists()) | self.assertTrue | func_call | tests/test_failures.py | test_failure_log | FailureLogTestCase | 11 | null |
jazzband/django-axes | from contextlib import suppress
from importlib import reload
from django.contrib import admin
from django.test import override_settings
import axes.admin
from axes.models import AccessAttempt, AccessLog, AccessFailureLog
from tests.base import AxesTestCase
class AxesEnableAdminFlag(AxesTestCase):
def setUp(self)... | admin.site.is_registered(AccessFailureLog)) | self.assertFalse | func_call | tests/test_admin.py | test_disable_admin | AxesEnableAdminFlag | 26 | null |
jazzband/django-axes | from datetime import timedelta
from importlib import import_module
from time import sleep
from django.contrib.auth import get_user_model, login, logout
from django.http import HttpRequest
from django.test import override_settings, TestCase
from django.urls import reverse
from axes.conf import settings
from axes.helpe... | 200) | self.assertEqual | numeric_literal | tests/test_login.py | test_client_login | DjangoTestClientLoginTestCase | 51 | null |
jazzband/django-axes | from io import StringIO
from unittest.mock import patch, Mock
from django.core.management import call_command
from django.utils import timezone
from axes.models import AccessAttempt, AccessLog
from tests.base import AxesTestCase
class ResetAccessLogsManagementCommandTestCase(AxesTestCase):
def setUp(self):
... | out.getvalue()) | self.assertEqual | func_call | tests/test_management.py | test_axes_delete_access_logs_default | ResetAccessLogsManagementCommandTestCase | 31 | null |
jazzband/django-axes | from django.conf import settings
from django.http import HttpResponse, HttpRequest
from django.test import override_settings
from axes.middleware import AxesMiddleware
from tests.base import AxesTestCase
def get_username(request, credentials: dict) -> str:
return credentials.get(settings.AXES_USERNAME_FORM_FIELD)... | self.STATUS_LOCKOUT) | self.assertEqual | complex_expr | tests/test_middleware.py | test_lockout_response | MiddlewareTestCase | 34 | null |
jazzband/django-axes | from datetime import timedelta
from hashlib import sha256
from unittest.mock import patch
from django.contrib.auth import get_user_model
from django.http import HttpRequest, HttpResponse, HttpResponseRedirect, JsonResponse
from django.test import RequestFactory, override_settings
from axes.apps import AppConfig
from ... | 900) | self.assertEqual | numeric_literal | tests/test_helpers.py | test_get_increasing_cache_timeout_by_username | CacheTestCase | 85 | null |
jazzband/django-axes | from unittest.mock import patch
from django.test import override_settings
from axes import __version__
from axes.apps import AppConfig
from axes.models import AccessAttempt, AccessLog
from tests.base import AxesTestCase
_BEGIN = "AXES: BEGIN version %s, %s"
_VERSION = __version__
class AccessLogTestCase(AxesTestCas... | 200) | self.assertEqual | numeric_literal | tests/test_logging.py | test_non_valid_login_without_log | AccessLogTestCase | 129 | null |
jazzband/django-axes | from django.apps.registry import apps
from django.db import connection
from django.db.migrations.autodetector import MigrationAutodetector
from django.db.migrations.executor import MigrationExecutor
from django.db.migrations.state import ProjectState
from axes.models import AccessAttempt, AccessLog, AccessFailureLog
f... | changes) | self.assertEqual | variable | tests/test_models.py | test_missing_migrations | MigrationsTestCase | 40 | null |
jazzband/django-axes | from unittest.mock import patch, MagicMock
from axes.backends import AxesBackend
from axes.exceptions import (
AxesBackendRequestParameterRequired,
AxesBackendPermissionDenied,
)
from tests.base import AxesTestCase
class BackendTestCase(AxesTestCase):
def test_authenticate_raises_on_missing_request(self):... | AxesBackendRequestParameterRequired) | self.assertRaises | variable | tests/test_backends.py | test_authenticate_raises_on_missing_request | BackendTestCase | 15 | null |
jazzband/django-axes | from datetime import timedelta
from importlib import import_module
from time import sleep
from django.contrib.auth import get_user_model, login, logout
from django.http import HttpRequest
from django.test import override_settings, TestCase
from django.urls import reverse
from axes.conf import settings
from axes.helpe... | self.ALLOWED) | self.assertEqual | complex_expr | tests/test_login.py | test_lockout_by_ip_allows_when_same_user_diff_ip_without_cache | DatabaseLoginTestCase | 397 | null |
jazzband/django-axes | from unittest.mock import patch
from django.test import override_settings
from axes import __version__
from axes.apps import AppConfig
from axes.models import AccessAttempt, AccessLog
from tests.base import AxesTestCase
_BEGIN = "AXES: BEGIN version %s, %s"
_VERSION = __version__
class AppsTestCase(AxesTestCase):
... | calls == log.info.call_count and calls > 0) | self.assertTrue | complex_expr | tests/test_logging.py | test_axes_config_log_re_entrant | AppsTestCase | 26 | null |
jazzband/django-axes | from unittest.mock import patch
from django.test import override_settings
from axes import __version__
from axes.apps import AppConfig
from axes.models import AccessAttempt, AccessLog
from tests.base import AxesTestCase
_BEGIN = "AXES: BEGIN version %s, %s"
_VERSION = __version__
class AppsTestCase(AxesTestCase):
... | log.info.called) | self.assertFalse | complex_expr | tests/test_logging.py | test_axes_config_log_not_verbose | AppsTestCase | 34 | null |
jazzband/django-axes | from unittest.mock import patch
from django.http import HttpRequest
from django.test import override_settings, RequestFactory
from django.utils.timezone import now
from axes.attempts import get_cool_off_threshold
from axes.models import AccessAttempt
from axes.utils import reset, reset_request
from tests.base import ... | 3) | self.assertEqual | numeric_literal | tests/test_attempts.py | test_reset_ip | ResetResponseTestCase | 73 | null |
jazzband/django-axes | from unittest.mock import patch
from django.test import override_settings
from axes import __version__
from axes.apps import AppConfig
from axes.models import AccessAttempt, AccessLog
from tests.base import AxesTestCase
_BEGIN = "AXES: BEGIN version %s, %s"
_VERSION = __version__
class AccessLogTestCase(AxesTestCas... | 1024) | self.assertEqual | numeric_literal | tests/test_logging.py | test_log_data_truncated | AccessLogTestCase | 86 | null |
jazzband/django-axes | from unittest.mock import patch
from django.http import HttpRequest
from django.test import override_settings, RequestFactory
from django.utils.timezone import now
from axes.attempts import get_cool_off_threshold
from axes.models import AccessAttempt
from axes.utils import reset, reset_request
from tests.base import ... | AccessAttempt.objects.count()) | self.assertFalse | func_call | tests/test_attempts.py | test_reset | ResetTestCase | 38 | null |
jazzband/django-axes | from platform import python_implementation
from unittest.mock import MagicMock, patch
from datetime import datetime, timezone as dt_timezone
from django.test import override_settings
from django.utils import timezone
from axes.handlers.database import AxesDatabaseHandler
from axes.models import AccessAttempt, AccessLog... | 4) | self.assertEqual | numeric_literal | tests/test_handlers.py | test_handler_reset_attempts_ip_and_username | ResetAttemptsTestCase | 204 | null |
jazzband/django-axes | from datetime import timedelta
from importlib import import_module
from time import sleep
from django.contrib.auth import get_user_model, login, logout
from django.http import HttpRequest
from django.test import override_settings, TestCase
from django.urls import reverse
from axes.conf import settings
from axes.helpe... | self.BLOCKED) | self.assertEqual | complex_expr | tests/test_login.py | test_lockout_by_user_agent_only | DatabaseLoginTestCase | 258 | null |
jazzband/django-axes | from datetime import timedelta
from hashlib import sha256
from unittest.mock import patch
from django.contrib.auth import get_user_model
from django.http import HttpRequest, HttpResponse, HttpResponseRedirect, JsonResponse
from django.test import RequestFactory, override_settings
from axes.apps import AppConfig
from ... | None) | self.assertEqual | none_literal | tests/test_helpers.py | test_get_cache_timeout_none | CacheTestCase | 60 | null |
jazzband/django-axes | from django.test import TestCase
from django.utils.functional import SimpleLazyObject
class ConfTestCase(TestCase):
def test_axes_username_form_field_evaluates_correctly(self):
"""
Test that when AXES_USERNAME_FORM_FIELD is accessed, it correctly
resolves to the user model's USERNAME_FIELD... | expected_username_field) | self.assertEqual | variable | tests/test_conf.py | test_axes_username_form_field_evaluates_correctly | ConfTestCase | 45 | null |
jazzband/django-axes | from unittest.mock import patch
from django.http import HttpRequest
from django.test import override_settings, RequestFactory
from django.utils.timezone import now
from axes.attempts import get_cool_off_threshold
from axes.models import AccessAttempt
from axes.utils import reset, reset_request
from tests.base import ... | 2) | self.assertEqual | numeric_literal | tests/test_attempts.py | test_reset_ip_username_user_or_ip | ResetResponseTestCase | 132 | null |
jazzband/django-axes | from axes.models import AccessFailureLog
from tests.base import AxesTestCase
from axes.helpers import get_failure_limit
from django.test import override_settings
class FailureLogTestCase(AxesTestCase):
def test_failure_log(self):
self.login(is_valid_username=True, is_valid_password=False)
self.asse... | AccessFailureLog.objects.filter(ip_address=self.ip_address).exists()) | self.assertTrue | func_call | tests/test_failures.py | test_failure_log | FailureLogTestCase | 12 | null |
jazzband/django-axes | from contextlib import suppress
from importlib import reload
from django.contrib import admin
from django.test import override_settings
import axes.admin
from axes.models import AccessAttempt, AccessLog, AccessFailureLog
from tests.base import AxesTestCase
class AxesEnableAdminFlag(AxesTestCase):
def setUp(self)... | admin.site.is_registered(AccessLog)) | self.assertFalse | func_call | tests/test_admin.py | test_disable_admin | AxesEnableAdminFlag | 25 | null |
jazzband/django-axes | from datetime import timedelta
from hashlib import sha256
from unittest.mock import patch
from django.contrib.auth import get_user_model
from django.http import HttpRequest, HttpResponse, HttpResponseRedirect, JsonResponse
from django.test import RequestFactory, override_settings
from axes.apps import AppConfig
from ... | 300) | self.assertEqual | numeric_literal | tests/test_helpers.py | test_get_increasing_cache_timeout_by_username | CacheTestCase | 81 | null |
jazzband/django-axes | from unittest.mock import patch
from django.test import override_settings
from axes import __version__
from axes.apps import AppConfig
from axes.models import AccessAttempt, AccessLog
from tests.base import AxesTestCase
_BEGIN = "AXES: BEGIN version %s, %s"
_VERSION = __version__
class AppsTestCase(AxesTestCase):
... | "blocking by username") | assert_* | string_literal | tests/test_logging.py | test_axes_config_log_user_only | AppsTestCase | 39 | null |
jazzband/django-axes | from unittest.mock import patch
from django.test import override_settings
from axes import __version__
from axes.apps import AppConfig
from axes.models import AccessAttempt, AccessLog
from tests.base import AxesTestCase
_BEGIN = "AXES: BEGIN version %s, %s"
_VERSION = __version__
class AppsTestCase(AxesTestCase):
... | "blocking by combination of username and ip_address") | assert_* | string_literal | tests/test_logging.py | test_axes_config_log_user_ip | AppsTestCase | 48 | null |
jazzband/django-axes | from django.apps.registry import apps
from django.db import connection
from django.db.migrations.autodetector import MigrationAutodetector
from django.db.migrations.executor import MigrationExecutor
from django.db.migrations.state import ProjectState
from axes.models import AccessAttempt, AccessLog, AccessFailureLog
f... | str(self.access_attempt)) | self.assertIn | func_call | tests/test_models.py | test_access_attempt_str | ModelsTestCase | 22 | null |
jazzband/django-axes | from unittest.mock import MagicMock
from axes.signals import user_locked_out
from tests.base import AxesTestCase
class SignalTestCase(AxesTestCase):
def test_send_lockout_signal(self):
"""
Test if the lockout signal is correctly emitted when user is locked out.
"""
handler = Magic... | handler.call_count) | self.assertEqual | complex_expr | tests/test_signals.py | test_send_lockout_signal | SignalTestCase | 16 | null |
jazzband/django-axes | from contextlib import suppress
from importlib import reload
from django.contrib import admin
from django.test import override_settings
import axes.admin
from axes.models import AccessAttempt, AccessLog, AccessFailureLog
from tests.base import AxesTestCase
class AxesEnableAdminFlag(AxesTestCase):
def setUp(self)... | admin.site.is_registered(AccessAttempt)) | self.assertFalse | func_call | tests/test_admin.py | test_disable_admin | AxesEnableAdminFlag | 24 | null |
jazzband/django-axes | from django.apps.registry import apps
from django.db import connection
from django.db.migrations.autodetector import MigrationAutodetector
from django.db.migrations.executor import MigrationExecutor
from django.db.migrations.state import ProjectState
from axes.models import AccessAttempt, AccessLog, AccessFailureLog
f... | str(self.access_log)) | self.assertIn | func_call | tests/test_models.py | test_access_log_str | ModelsTestCase | 25 | null |
jazzband/django-axes | from unittest.mock import patch
from django.test import override_settings
from axes import __version__
from axes.apps import AppConfig
from axes.models import AccessAttempt, AccessLog
from tests.base import AxesTestCase
_BEGIN = "AXES: BEGIN version %s, %s"
_VERSION = __version__
class AccessLogTestCase(AxesTestCas... | other_log.logout_time) | self.assertIsNone | complex_expr | tests/test_logging.py | test_access_log_on_logout | AccessLogTestCase | 68 | null |
jazzband/django-axes | from datetime import timedelta
from hashlib import sha256
from unittest.mock import patch
from django.contrib.auth import get_user_model
from django.http import HttpRequest, HttpResponse, HttpResponseRedirect, JsonResponse
from django.test import RequestFactory, override_settings
from axes.apps import AppConfig
from ... | actual) | self.assertEqual | variable | tests/test_helpers.py | test_verbose_ip_only_client_details | ClientStringTestCase | 138 | null |
jazzband/django-axes | from unittest.mock import patch
from django.http import HttpRequest
from django.test import override_settings, RequestFactory
from django.utils.timezone import now
from axes.attempts import get_cool_off_threshold
from axes.models import AccessAttempt
from axes.utils import reset, reset_request
from tests.base import ... | TypeError) | self.assertRaises | variable | tests/test_attempts.py | test_get_cool_off_threshold_error | GetCoolOffThresholdTestCase | 30 | null |
jazzband/django-axes | from unittest.mock import patch
from django.test import override_settings
from axes import __version__
from axes.apps import AppConfig
from axes.models import AccessAttempt, AccessLog
from tests.base import AxesTestCase
_BEGIN = "AXES: BEGIN version %s, %s"
_VERSION = __version__
class AccessLogTestCase(AxesTestCas... | 0) | self.assertEqual | numeric_literal | tests/test_logging.py | test_valid_logout_without_success_log | AccessLogTestCase | 95 | null |
jazzband/django-axes | from unittest.mock import MagicMock, patch
from django.http import HttpResponse
from axes.decorators import axes_dispatch, axes_form_invalid
from tests.base import AxesTestCase
class DecoratorTestCase(AxesTestCase):
SUCCESS_RESPONSE = HttpResponse(status=200, content="Dispatched")
LOCKOUT_RESPONSE = HttpResp... | self.LOCKOUT_RESPONSE.content) | self.assertEqual | complex_expr | tests/test_decorators.py | test_axes_dispatch_locks_out | DecoratorTestCase | 22 | null |
jazzband/django-axes | from django.core.checks import run_checks, Warning # pylint: disable=redefined-builtin
from django.test import override_settings, modify_settings
from axes.backends import AxesStandaloneBackend
from axes.checks import Messages, Hints, Codes
from tests.base import AxesTestCase
class CacheCheckTestCase(AxesTestCase):
... | []) | self.assertEqual | collection | tests/test_checks.py | test_cache_check | CacheCheckTestCase | 21 | null |
jazzband/django-axes | from django.conf import settings
from django.http import HttpResponse, HttpRequest
from django.test import override_settings
from axes.middleware import AxesMiddleware
from tests.base import AxesTestCase
def get_username(request, credentials: dict) -> str:
return credentials.get(settings.AXES_USERNAME_FORM_FIELD)... | self.STATUS_SUCCESS) | self.assertEqual | complex_expr | tests/test_middleware.py | test_success_response | MiddlewareTestCase | 26 | null |
jazzband/django-axes | from unittest.mock import patch
from django.http import HttpRequest
from django.test import override_settings, RequestFactory
from django.utils.timezone import now
from axes.attempts import get_cool_off_threshold
from axes.models import AccessAttempt
from axes.utils import reset, reset_request
from tests.base import ... | 4) | self.assertEqual | numeric_literal | tests/test_attempts.py | test_reset_ip_username_user_and_ip | ResetResponseTestCase | 156 | null |
jazzband/django-axes | from django.core.checks import run_checks, Warning # pylint: disable=redefined-builtin
from django.test import override_settings, modify_settings
from axes.backends import AxesStandaloneBackend
from axes.checks import Messages, Hints, Codes
from tests.base import AxesTestCase
class BackendCheckTestCase(AxesTestCase)... | ImportError) | self.assertRaises | variable | tests/test_checks.py | test_import_error | BackendCheckTestCase | 90 | null |
jazzband/django-axes | from django.test import TestCase
from django.utils.functional import SimpleLazyObject
class ConfTestCase(TestCase):
def test_axes_username_form_field_uses_lazy_evaluation(self):
"""
Test that AXES_USERNAME_FORM_FIELD uses SimpleLazyObject for lazy evaluation.
This prevents circular import i... | str) | self.assertIsInstance | variable | tests/test_conf.py | test_axes_username_form_field_uses_lazy_evaluation | ConfTestCase | 27 | null |
jazzband/django-axes | from django.core.checks import run_checks, Warning # pylint: disable=redefined-builtin
from django.test import override_settings, modify_settings
from axes.backends import AxesStandaloneBackend
from axes.checks import Messages, Hints, Codes
from tests.base import AxesTestCase
class DeprecatedSettingsTestCase(AxesTes... | [self.disable_success_access_log_warning]) | self.assertEqual | collection | tests/test_checks.py | test_deprecated_success_access_log_flag | DeprecatedSettingsTestCase | 112 | null |
jazzband/django-axes | from unittest.mock import patch
from django.test import override_settings
from axes import __version__
from axes.apps import AppConfig
from axes.models import AccessAttempt, AccessLog
from tests.base import AxesTestCase
_BEGIN = "AXES: BEGIN version %s, %s"
_VERSION = __version__
class AccessLogTestCase(AxesTestCas... | latest_log.logout_time) | self.assertIsNone | complex_expr | tests/test_logging.py | test_access_log_on_logout | AccessLogTestCase | 66 | null |
jazzband/django-axes | from django.apps.registry import apps
from django.db import connection
from django.db.migrations.autodetector import MigrationAutodetector
from django.db.migrations.executor import MigrationExecutor
from django.db.migrations.state import ProjectState
from axes.models import AccessAttempt, AccessLog, AccessFailureLog
f... | str(self.access_failure_log)) | self.assertIn | func_call | tests/test_models.py | test_access_failure_log_str | ModelsTestCase | 28 | null |
jazzband/django-axes | from datetime import timedelta
from hashlib import sha256
from unittest.mock import patch
from django.contrib.auth import get_user_model
from django.http import HttpRequest, HttpResponse, HttpResponseRedirect, JsonResponse
from django.test import RequestFactory, override_settings
from axes.apps import AppConfig
from ... | 600) | self.assertEqual | numeric_literal | tests/test_helpers.py | test_get_increasing_cache_timeout_by_username | CacheTestCase | 84 | null |
jazzband/django-axes | from unittest.mock import patch
from django.test import override_settings
from axes import __version__
from axes.apps import AppConfig
from axes.models import AccessAttempt, AccessLog
from tests.base import AxesTestCase
_BEGIN = "AXES: BEGIN version %s, %s"
_VERSION = __version__
class AppsTestCase(AxesTestCase):
... | "blocking by username or ip_address") | assert_* | string_literal | tests/test_logging.py | test_axes_config_log_user_or_ip | AppsTestCase | 55 | null |
orbingol/NURBS-Python | import pytest
from geomdl import CPGen
GRID_TOL = 10e-8
def grid():
"""Generates a 3x4 control points grid"""
surfgrid = CPGen.Grid(7, 13)
surfgrid.generate(3, 4)
return surfgrid
def grid2():
"""Generates a 6x6 control points grid"""
surfgrid = CPGen.Grid(7, 13)
surfgrid.generate(16, 16)
... | 14 | assert | numeric_literal | tests/test_surfgen.py | test_grid_generate5 | 66 | null | |
orbingol/NURBS-Python | from pytest import fixture, mark
from geomdl import BSpline
from geomdl import evaluators
from geomdl import convert
from geomdl import helpers
GEOMDL_DELTA = 0.001
def spline_surf():
"""Creates a B-spline surface instance"""
# Create a surface instance
surf = BSpline.Surface()
# Set degrees
surf... | s_post | assert | variable | tests/test_surface.py | test_bspline_surface_remove_knot_u | 180 | null | |
orbingol/NURBS-Python | import pytest
from geomdl import CPGen
GRID_TOL = 10e-8
def grid():
"""Generates a 3x4 control points grid"""
surfgrid = CPGen.Grid(7, 13)
surfgrid.generate(3, 4)
return surfgrid
def grid2():
"""Generates a 6x6 control points grid"""
surfgrid = CPGen.Grid(7, 13)
surfgrid.generate(16, 16)
... | TypeError) | pytest.raises | variable | tests/test_surfgen.py | test_grid_weight2 | 151 | null | |
orbingol/NURBS-Python | import pytest
from geomdl import CPGen
GRID_TOL = 10e-8
def grid():
"""Generates a 3x4 control points grid"""
surfgrid = CPGen.Grid(7, 13)
surfgrid.generate(3, 4)
return surfgrid
def grid2():
"""Generates a 6x6 control points grid"""
surfgrid = CPGen.Grid(7, 13)
surfgrid.generate(16, 16)
... | ValueError) | pytest.raises | variable | tests/test_surfgen.py | test_grid_generate1 | 38 | null | |
orbingol/NURBS-Python | from pytest import fixture, mark
from geomdl import BSpline
from geomdl import evaluators
from geomdl import helpers
from geomdl import convert
from geomdl import operations
GEOMDL_DELTA = 0.001
def spline_curve():
"""Creates a spline Curve"""
curve = BSpline.Curve()
curve.degree = 3
curve.ctrlpts = [... | 0 | assert | numeric_literal | tests/test_curve.py | test_bspline_curve2d_remove_knot_kv | 119 | null | |
orbingol/NURBS-Python | import pytest
from geomdl import CPGen
GRID_TOL = 10e-8
def grid():
"""Generates a 3x4 control points grid"""
surfgrid = CPGen.Grid(7, 13)
surfgrid.generate(3, 4)
return surfgrid
def grid2():
"""Generates a 6x6 control points grid"""
surfgrid = CPGen.Grid(7, 13)
surfgrid.generate(16, 16)
... | 17 | assert | numeric_literal | tests/test_surfgen.py | test_grid_generate5 | 65 | null | |
orbingol/NURBS-Python | import pytest
from geomdl import utilities
from geomdl import knotvector
from geomdl import control_points
from geomdl.exceptions import GeomdlException
GEOMDL_DELTA = 10e-6
def test_cpman_curve4():
"""Control Points Manager: get-set attachment (valid, list)"""
d = [0.0, 1.0, 2.0, 3.0]
p = 5
sz = 12
... | 0.0 | assert | numeric_literal | tests/test_utils.py | test_cpman_curve4 | 170 | null | |
orbingol/NURBS-Python | from pytest import fixture, mark
from geomdl import BSpline
from geomdl import evaluators
from geomdl import helpers
from geomdl import convert
from geomdl import operations
GEOMDL_DELTA = 0.001
def spline_curve():
"""Creates a spline Curve"""
curve = BSpline.Curve()
curve.degree = 3
curve.ctrlpts = [... | s_post | assert | variable | tests/test_curve.py | test_bspline_curve2d_insert_knot | 91 | null | |
orbingol/NURBS-Python | import pytest
from geomdl import CPGen
GRID_TOL = 10e-8
def grid():
"""Generates a 3x4 control points grid"""
surfgrid = CPGen.Grid(7, 13)
surfgrid.generate(3, 4)
return surfgrid
def grid2():
"""Generates a 6x6 control points grid"""
surfgrid = CPGen.Grid(7, 13)
surfgrid.generate(16, 16)
... | 18 | assert | numeric_literal | tests/test_surfgen.py | test_grid_generate5 | 67 | null | |
orbingol/NURBS-Python | import pytest
from geomdl import utilities
from geomdl import knotvector
from geomdl import control_points
from geomdl.exceptions import GeomdlException
GEOMDL_DELTA = 10e-6
def test_normalize_knot_vector2():
input_kv = (-5, -5, -3, -2, 2, 3, 5, 5)
output_kv = [0.0, 0.0, 0.2, 0.3, 0.7, 0.8, 1.0, 1.0]
to_c... | output_kv | assert | variable | tests/test_utils.py | test_normalize_knot_vector2 | 95 | null | |
orbingol/NURBS-Python | from geomdl import compatibility
P = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
W = [0.5, 2, 1]
PW = [[0.5, 1, 1.5, 0.5], [8, 10, 12, 2], [7, 8, 9, 1]]
PW_ONES = [[1, 2, 3, 1], [4, 5, 6, 1], [7, 8, 9, 1]]
PW_SEP = [[1, 2, 3, 0.5], [4, 5, 6, 2], [7, 8, 9, 1]]
def test_separate_ctrlpts_weights():
c_ctrlpts, c_weights = comp... | c_ctrlpts | assert | variable | tests/test_compatibility.py | test_separate_ctrlpts_weights | 44 | null | |
orbingol/NURBS-Python | import pytest
from geomdl import utilities
from geomdl import knotvector
from geomdl import control_points
from geomdl.exceptions import GeomdlException
GEOMDL_DELTA = 10e-6
def test_cpman_curve2():
"""Control Points Manager: get empty point (curve)"""
p = 5
sz = 12
cpman = control_points.CurveManager... | list() | assert | func_call | tests/test_utils.py | test_cpman_curve2 | 149 | null | |
orbingol/NURBS-Python | from geomdl import compatibility
P = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
W = [0.5, 2, 1]
PW = [[0.5, 1, 1.5, 0.5], [8, 10, 12, 2], [7, 8, 9, 1]]
PW_ONES = [[1, 2, 3, 1], [4, 5, 6, 1], [7, 8, 9, 1]]
PW_SEP = [[1, 2, 3, 0.5], [4, 5, 6, 2], [7, 8, 9, 1]]
def test_generate_ctrlptsw2d_ops():
ctrlpts_weights_2d = [
... | ctrlpts_weights_2d | assert | variable | tests/test_compatibility.py | test_generate_ctrlptsw2d_ops | 159 | null | |
orbingol/NURBS-Python | import pytest
from geomdl import utilities
from geomdl import knotvector
from geomdl import control_points
from geomdl.exceptions import GeomdlException
GEOMDL_DELTA = 10e-6
def test_generate_knot_vector4():
degree = 4
num_ctrlpts = 12
autogen_kv = knotvector.generate(degree, num_ctrlpts)
result = [0.... | result | assert | variable | tests/test_utils.py | test_generate_knot_vector4 | 41 | null |
End of preview. Expand in Data Studio
Code2LoRA-Static — static track (single snapshot)
The Static track of RepoPeftBench exactly as consumed by the paper's
main-results table (Code2LoRA-Static, single anchor snapshot per
repository). Contains only the paper-used QnAs (post quality-filter). For
the out-of-distribution slice see code2lora/repopeftbench-ood.
| config | split | rows |
|---|---|---|
| qna | train | 39,612 |
| qna | cr_val | 6,213 |
| qna | cr_test | 6,414 |
| qna | ir_val | 4,833 |
| qna | ir_test | 5,222 |
| repos | train / cr_val / cr_test | 409 / 51 / 52 |
qna— one row per assertion pair (repo_id, prefix, target, assertion_type, difficulty, test_file, test_function, test_class, lineno, commit_idx).repos— frozen 2048-d Qwen3-Embedding repo-state vector per repo (repo_id, embedding); IR suites reuse the train-repo embeddings.
from datasets import load_dataset
qna = load_dataset("code2lora/code2lora-static", "qna")
repos = load_dataset("code2lora/code2lora-static", "repos")
Companion datasets: code2lora/code2lora-evo,
code2lora/code2lora-static-anchor, code2lora/repopeftbench-ood.
- Downloads last month
- 19