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 |
|---|---|---|---|---|---|---|---|---|---|
theQRL/QRL | from unittest import TestCase
from pyqrllib.pyqrllib import bin2hstr
from qrl.core.Wallet import Wallet, WalletEncryptionError, WalletVersionError, WalletDecryptionError
from qrl.core.misc import logger
from tests.misc.helper import set_qrl_dir
logger.initialize_default()
class TestWallet(TestCase):
def __init_... | wallet.addresses) | self.assertEqual | complex_expr | tests/core/test_Wallet.py | test_decrypt_wallet | TestWallet | 265 | null |
theQRL/QRL | from unittest import TestCase
from mock import patch, Mock, PropertyMock
from pyqrllib.pyqrllib import sha2_256
from collections import OrderedDict
from tests.misc.helper import get_alice_xmss, get_bob_xmss, get_slave_xmss
from qrl.core import config
from qrl.generated import qrl_pb2
from qrl.core.State import State
f... | 4) | self.assertEqual | numeric_literal | tests/core/test_block.py | test_mining_blob | TestBlockReal | 66 | null |
theQRL/QRL | from unittest import TestCase
from mock import Mock, MagicMock, patch
from qrl.core.Block import Block
from qrl.core.BlockHeader import BlockHeader
from qrl.core.BlockMetadata import BlockMetadata
from qrl.core.ChainManager import ChainManager
from qrl.core import config
from qrl.core.misc import logger
from qrl.core... | answer.error) | self.assertTrue | complex_expr | tests/services/test_MiningAPIService.py | test_SubmitMinedBlock | TestMiningAPI | 109 | null |
theQRL/QRL | from unittest import TestCase
import simplejson as json
from mock import patch, Mock, PropertyMock
from pyqrllib.pyqrllib import bin2hstr
from qrl.core import config
from qrl.core.Indexer import Indexer
from qrl.core.OptimizedAddressState import OptimizedAddressState
from qrl.core.misc import logger
from qrl.core.Sta... | len(result)) | self.assertEqual | func_call | tests/core/txs/test_MessageTransaction.py | test_set_affected_address | TestMessageTransaction | 157 | null |
theQRL/QRL | from unittest import TestCase
from mock import patch, PropertyMock
from qrl.core import config
from qrl.core.Indexer import Indexer
from qrl.core.State import State
from qrl.core.StateContainer import StateContainer
from qrl.core.OptimizedAddressState import OptimizedAddressState
from qrl.core.txs.SlaveTransaction im... | tx.validate_or_raise()) | self.assertTrue | func_call | tests/core/txs/test_SlaveTransaction.py | test_validate_tx | TestSlaveTransaction | 135 | null |
theQRL/QRL | from collections import namedtuple
from unittest import TestCase
from mock import Mock, patch, MagicMock
from pyqrllib.pyqrllib import hstr2bin, bin2hstr
from qrl.core.misc import logger
from qrl.core.p2p import p2pPeerManager
from qrl.core.p2p.p2pfactory import P2PFactory, p2p_msg_priority
from qrl.core.p2p.p2pproto... | synced) | assert_* | variable | tests/core/p2p/test_p2pprotocol.py | test_send_sync | TestP2PProtocol | 137 | null |
theQRL/QRL | import heapq
from unittest import TestCase
from grpc import ServicerContext, StatusCode
from mock import Mock, MagicMock, patch, PropertyMock
from pyqrllib.pyqrllib import str2bin, hstr2bin, bin2hstr
from qrl.core import config
from qrl.core.AddressState import AddressState
from qrl.core.OptimizedAddressState import ... | response.tx) | self.assertIsNotNone | complex_expr | tests/services/test_PublicAPIService.py | test_getTransaction | TestPublicAPI | 553 | null |
theQRL/QRL | from unittest import TestCase
from qrl.core import config
from qrl.core.misc import logger
from qrl.core.GenesisBlock import GenesisBlock
from tests.misc.helper import clean_genesis
logger.initialize_default()
class TestGenesisBlock(TestCase):
def __init__(self, *args, **kwargs):
super(TestGenesisBlock, ... | gb.prev_headerhash) | self.assertEqual | complex_expr | tests/core/test_GenesisBlock.py | test_genesis_block_values | TestGenesisBlock | 25 | null |
theQRL/QRL | from unittest import TestCase
from mock import Mock, mock, patch
from qrl.core import config
from qrl.core.State import State
from qrl.core.ChainManager import ChainManager
from qrl.core.misc import logger
from tests.misc.helper import set_qrl_dir
logger.initialize_default()
class TestStateMeasurement(TestCase):
... | block.headerhash) | self.assertEqual | complex_expr | tests/core/test_State_Measurements.py | test_check_mock | TestStateMeasurement | 75 | null |
theQRL/QRL | from unittest import TestCase
import simplejson as json
from mock import patch, PropertyMock
from pyqrllib.pyqrllib import bin2hstr
from qrl.core import config
from qrl.core.Indexer import Indexer
from qrl.core.misc import logger
from qrl.core.State import State
from qrl.core.StateContainer import StateContainer
from... | tx.validate_or_raise()) | self.assertTrue | func_call | tests/core/txs/test_TokenTransaction.py | test_validate_tx | TestTokenTransaction | 132 | null |
theQRL/QRL | from unittest import TestCase
import simplejson as json
from mock import patch, Mock, PropertyMock
from pyqrllib.pyqrllib import bin2hstr
from qrl.core import config
from qrl.core.Indexer import Indexer
from qrl.core.OptimizedAddressState import OptimizedAddressState
from qrl.core.misc import logger
from qrl.core.Sta... | result) | self.assertTrue | variable | tests/core/txs/test_MessageTransaction.py | test_validate_extended | TestMessageTransaction | 133 | null |
theQRL/QRL | from unittest import TestCase
import simplejson as json
from mock import patch, Mock, PropertyMock
from pyqrllib.pyqrllib import bin2hstr
from qrl.core import config
from qrl.core.Indexer import Indexer
from qrl.core.OptimizedAddressState import OptimizedAddressState
from qrl.core.misc import logger
from qrl.core.Sta... | tx) | self.assertTrue | variable | tests/core/txs/test_MessageTransaction.py | test_create | TestMessageTransaction | 42 | null |
theQRL/QRL | from collections import namedtuple
from unittest import TestCase
from mock import Mock, patch, MagicMock
from pyqrllib.pyqrllib import hstr2bin, bin2hstr
from qrl.core.misc import logger
from qrl.core.p2p import p2pPeerManager
from qrl.core.p2p.p2pfactory import P2PFactory, p2p_msg_priority
from qrl.core.p2p.p2pproto... | self.channel) | assert_* | complex_expr | tests/core/p2p/test_p2pprotocol.py | test_connectionMade_behavior | TestP2PProtocol | 74 | null |
theQRL/QRL | from unittest import TestCase
import simplejson as json
from mock import patch, PropertyMock
from pyqrllib.pyqrllib import bin2hstr
from qrl.core import config
from qrl.core.Indexer import Indexer
from qrl.core.misc import logger
from qrl.core.State import State
from qrl.core.StateContainer import StateContainer
from... | len(result)) | self.assertEqual | func_call | tests/core/txs/test_TokenTransaction.py | test_affected_address | TestTokenTransaction | 304 | null |
theQRL/QRL | from unittest import TestCase
import simplejson as json
from mock import patch, Mock, PropertyMock
from pyqrllib.pyqrllib import bin2hstr
from qrl.core import config
from qrl.core.Indexer import Indexer
from qrl.core.OptimizedAddressState import OptimizedAddressState
from qrl.core.misc import logger
from qrl.core.Sta... | tx.fee) | self.assertEqual | complex_expr | tests/core/txs/test_MessageTransaction.py | test_from_json | TestMessageTransaction | 71 | null |
theQRL/QRL | from unittest import TestCase
from qrl.core.misc import logger
from tests.blockchain.MockedBlockchain import MockedBlockchain
logger.initialize_default()
class TestBlockchain(TestCase):
def __init__(self, *args, **kwargs):
super(TestBlockchain, self).__init__(*args, **kwargs)
def test_forking_basic(... | block_10._data) | self.assertEqual | complex_expr | tests/blockchain/test_Forking.py | test_forking_basic | TestBlockchain | 40 | null |
theQRL/QRL | from unittest import TestCase
from mock import MagicMock
from qrl.core.LastTransactions import LastTransactions
from qrl.core.misc import logger, db
from qrl.core.State import State
from qrl.core.txs.TransferTransaction import TransferTransaction
from qrl.core.Block import Block
from tests.misc.helper import set_qrl_... | tx3.to_json()) | self.assertEqual | func_call | tests/core/test_LastTransactions.py | test_update_last_tx | TestLastTransactions | 61 | null |
theQRL/QRL | from unittest import TestCase
from mock import Mock, mock, patch
from qrl.core import config
from qrl.core.State import State
from qrl.core.ChainManager import ChainManager
from qrl.core.misc import logger
from tests.misc.helper import set_qrl_dir
logger.initialize_default()
class TestStateMeasurement(TestCase):
... | state) | self.assertIsNotNone | variable | tests/core/test_State_Measurements.py | test_check_mock | TestStateMeasurement | 65 | null |
theQRL/QRL | from mock import PropertyMock, patch
from unittest import TestCase
from math import ceil
from qrl.core import config
from qrl.core.misc import logger
from qrl.core.State import State
from qrl.core.OptimizedAddressState import OptimizedAddressState
from qrl.core.PaginatedBitfield import PaginatedBitfield
from qrl.core.... | 1) | self.assertEqual | numeric_literal | tests/core/test_OptimizedAddressState.py | test_update_used_page_in_address_state | TestOptimizedAddressState | 88 | null |
theQRL/QRL | from unittest import TestCase
from mock import MagicMock
from qrl.core import config
from qrl.core.TransactionMetadata import TransactionMetadata
from qrl.core.misc import logger, db
from qrl.core.State import State
from qrl.core.txs.TransferTransaction import TransferTransaction
from qrl.core.Block import Block
from... | tx.to_json()) | self.assertEqual | func_call | tests/core/test_TransactionMetadata.py | test_update_tx_metadata | TestTransactionMetadata | 62 | null |
theQRL/QRL | from unittest import TestCase
from pyqrllib.pyqrllib import bin2hstr
from qrl.core.Wallet import Wallet, WalletEncryptionError, WalletVersionError, WalletDecryptionError
from qrl.core.misc import logger
from tests.misc.helper import set_qrl_dir
logger.initialize_default()
class TestWallet(TestCase):
def __init_... | wallet.encrypted) | self.assertTrue | complex_expr | tests/core/test_Wallet.py | test_read_secure | TestWallet | 143 | null |
theQRL/QRL | from unittest import TestCase
import simplejson as json
from qrl.core import config
from qrl.core.Indexer import Indexer
from qrl.core.State import State
from qrl.core.StateContainer import StateContainer
from qrl.core.misc import logger
from qrl.core.VoteStats import VoteStats
from qrl.core.OptimizedAddressState imp... | spend_tx.txhash) | self.assertEqual | complex_expr | tests/core/txs/multisig/test_MultiSigVote.py | test_apply | TestMultiSigVote | 292 | null |
theQRL/QRL | from mock import patch, PropertyMock
from unittest import TestCase
from qrl.core import config
from qrl.core.misc import logger
from qrl.core.PaginatedData import PaginatedData
from qrl.core.OptimizedAddressState import OptimizedAddressState
from qrl.core.State import State
from tests.misc.helper import set_qrl_dir, ... | 0) | self.assertEqual | numeric_literal | tests/core/test_PaginatedData.py | test_reset_key_value | TestPaginatedData | 28 | null |
theQRL/QRL | from unittest import TestCase
import simplejson as json
from mock import patch, PropertyMock
from pyqrllib.pyqrllib import bin2hstr
from qrl.core import config
from qrl.core.Indexer import Indexer
from qrl.core.misc import logger
from qrl.core.State import State
from qrl.core.StateContainer import StateContainer
from... | tx.symbol) | self.assertEqual | complex_expr | tests/core/txs/test_TokenTransaction.py | test_from_json | TestTokenTransaction | 103 | null |
theQRL/QRL | from unittest import TestCase
from mock import Mock
from qrl.core.MessageRequest import MessageRequest
class TestMessageRequest(TestCase):
def setUp(self):
self.mr = MessageRequest()
self.test_data = {
"camel": "animal",
"bitcoin": "cryptocoin"
}
def test_add_... | msg_type) | self.assertEqual | variable | tests/core/test_MessageRequest.py | test_add_peer | TestMessageRequest | 48 | null |
theQRL/QRL | from unittest import TestCase
import simplejson as json
from mock import patch, PropertyMock, Mock
from pyqrllib.pyqrllib import bin2hstr
from qrl.core import config
from qrl.core.Indexer import Indexer
from qrl.core.State import State
from qrl.core.StateContainer import StateContainer
from qrl.core.misc import logge... | tx.fee) | self.assertEqual | complex_expr | tests/core/txs/test_SimpleTransaction.py | test_from_json | TestSimpleTransaction | 103 | null |
theQRL/QRL | from unittest import TestCase
import simplejson as json
from mock import patch, PropertyMock
from pyqrllib.pyqrllib import bin2hstr
from qrl.core import config
from qrl.core.Indexer import Indexer
from qrl.core.misc import logger
from qrl.core.OptimizedAddressState import OptimizedAddressState
from qrl.core.State imp... | json.loads(txjson)) | self.assertEqual | func_call | tests/core/txs/test_TransferTokenTransaction.py | test_to_json | TestTransferTokenTransaction | 60 | null |
theQRL/QRL | from collections import OrderedDict
from unittest import TestCase
from mock import Mock, patch
from pyqrllib.pyqrllib import hstr2bin
from pyqryptonight.pyqryptonight import StringToUInt256
from twisted.internet import reactor
from qrl.core import config
from qrl.core.Block import Block
from qrl.core.State import Sta... | 3) | self.assertEqual | numeric_literal | tests/core/p2p/test_p2pfactory.py | test_add_connection_connection_limit | TestP2PFactory | 103 | null |
theQRL/QRL | from unittest import TestCase
from mock import MagicMock
from qrl.core.LastTransactions import LastTransactions
from qrl.core.misc import logger, db
from qrl.core.State import State
from qrl.core.txs.TransferTransaction import TransferTransaction
from qrl.core.Block import Block
from tests.misc.helper import set_qrl_... | []) | self.assertEqual | collection | tests/core/test_LastTransactions.py | test_update_last_tx | TestLastTransactions | 27 | null |
theQRL/QRL | from unittest import TestCase
from mock import Mock, MagicMock, patch
from qrl.core.Block import Block
from qrl.core.BlockHeader import BlockHeader
from qrl.core.BlockMetadata import BlockMetadata
from qrl.core.ChainManager import ChainManager
from qrl.core import config
from qrl.core.misc import logger
from qrl.core... | answer.depth) | self.assertEqual | complex_expr | tests/services/test_MiningAPIService.py | test_GetLastBlockHeader | TestMiningAPI | 81 | null |
theQRL/QRL | from unittest import TestCase
from mock import Mock, patch
from qrl.core.OptimizedAddressState import OptimizedAddressState
from qrl.core.Block import Block
from qrl.core.State import State
from qrl.core.ChainManager import ChainManager
from qrl.core.txs.CoinBase import CoinBase
from qrl.core.txs.TransferTransaction i... | 2) | self.assertEqual | numeric_literal | tests/core/test_TransactionPool.py | test_get_tx_index_from_pool | TestTransactionPool | 78 | null |
theQRL/QRL | from unittest import TestCase
from mock import MagicMock
from qrl.core.LastTransactions import LastTransactions
from qrl.core.misc import logger, db
from qrl.core.State import State
from qrl.core.txs.TransferTransaction import TransferTransaction
from qrl.core.Block import Block
from tests.misc.helper import set_qrl_... | 1) | self.assertEqual | numeric_literal | tests/core/test_LastTransactions.py | test_update_last_tx | TestLastTransactions | 40 | null |
theQRL/QRL | from unittest import TestCase
from grpc import ServicerContext
from mock import Mock, patch
from pyqrllib.pyqrllib import bin2hstr, QRLHelper
from qrl.core.ChainManager import ChainManager
from qrl.core.txs.Transaction import Transaction
from qrl.core.State import State
from qrl.core.misc import logger
from qrl.core.... | bin2hstr(tmp_hash_pre)) | self.assertEqual | func_call | tests/services/test_PublicAPIService_transfer.py | test_transferCoins_sign | TestPublicAPI | 247 | null |
theQRL/QRL | from unittest import TestCase
from mock import Mock, patch, PropertyMock, mock
from qrl.core import config
from qrl.core.misc import logger
from qrl.core.OptimizedAddressState import OptimizedAddressState
from qrl.core.Block import Block
from qrl.core.BlockMetadata import BlockMetadata
from qrl.core.ESyncState import ... | 3) | self.assertEqual | numeric_literal | tests/core/test_qrlnode.py | test_get_mini_transactions_by_address | TestQRLNode | 211 | null |
theQRL/QRL | from unittest import TestCase
import simplejson as json
from mock import patch, PropertyMock
from pyqrllib.pyqrllib import bin2hstr
from qrl.core import config
from qrl.core.Indexer import Indexer
from qrl.core.misc import logger
from qrl.core.OptimizedAddressState import OptimizedAddressState
from qrl.core.State imp... | tx.fee) | self.assertEqual | complex_expr | tests/core/txs/test_TransferTokenTransaction.py | test_from_json | TestTransferTokenTransaction | 91 | null |
theQRL/QRL | from unittest import TestCase
from pyqrllib.pyqrllib import str2bin
from qrl.core import config
from qrl.core.misc import logger
from qrl.core.messagereceipt import MessageReceipt
from qrl.generated.qrllegacy_pb2 import LegacyMessage
logger.initialize_default()
class TestMessageReceipt(TestCase):
def __init__(se... | mr) | self.assertIsNotNone | variable | tests/core/test_messagereceipt.py | test_create | TestMessageReceipt | 21 | null |
theQRL/QRL | from unittest import TestCase
import simplejson as json
from mock import patch, PropertyMock
from pyqrllib.pyqrllib import bin2hstr
from qrl.core import config
from qrl.core.Indexer import Indexer
from qrl.core.misc import logger
from qrl.core.OptimizedAddressState import OptimizedAddressState
from qrl.core.State imp... | result) | self.assertTrue | variable | tests/core/txs/test_TransferTokenTransaction.py | test_state_validate_tx_custom | TestTransferTokenTransaction | 135 | null |
theQRL/QRL | from unittest import TestCase
import simplejson as json
from qrl.core import config
from qrl.core.Indexer import Indexer
from qrl.core.State import State
from qrl.core.StateContainer import StateContainer
from qrl.core.misc import logger
from qrl.core.VoteStats import VoteStats
from qrl.core.OptimizedAddressState imp... | result) | self.assertTrue | variable | tests/core/txs/multisig/test_MultiSigVote.py | test_validate_custom | TestMultiSigVote | 86 | null |
theQRL/QRL | from unittest import TestCase
import simplejson as json
from mock import patch, PropertyMock
from pyqrllib.pyqrllib import bin2hstr
from qrl.core import config
from qrl.core.Indexer import Indexer
from qrl.core.misc import logger
from qrl.core.State import State
from qrl.core.StateContainer import StateContainer
from... | json.loads(txjson)) | self.assertEqual | func_call | tests/core/txs/test_TokenTransaction.py | test_to_json | TestTokenTransaction | 90 | null |
theQRL/QRL | import contextlib
from unittest import TestCase
from mock import Mock, MagicMock, patch
from pyqryptonight.pyqryptonight import StringToUInt256
from tests.misc.helper import get_alice_xmss, get_random_xmss
from qrl.core import config
from qrl.core.misc import logger
from qrl.core.OptimizedAddressState import Optimize... | node) | self.assertIsNotNone | variable | tests/core/test_node.py | test_create | TestNode | 51 | null |
theQRL/QRL | import os
import time
from unittest import TestCase
from mock import Mock, patch, mock
from pyqrllib.pyqrllib import hstr2bin
from pyqryptonight.pyqryptonight import StringToUInt256
from qrl.core import config
from qrl.core.misc import logger
from qrl.core.p2p.IPMetadata import IPMetadata
from qrl.core.p2p.p2pPeerMan... | config.dev.version) | self.assertEqual | complex_expr | tests/core/p2p/test_p2pPeerManager.py | test_handle_version_empty_version_message | TestP2PPeerManager | 223 | null |
theQRL/QRL | from unittest import TestCase
from qrl.core import config
from qrl.core.misc import logger
from qrl.core.GenesisBlock import GenesisBlock
from tests.misc.helper import clean_genesis
logger.initialize_default()
class TestGenesisBlock(TestCase):
def __init__(self, *args, **kwargs):
super(TestGenesisBlock, ... | gb.block_number) | self.assertEqual | complex_expr | tests/core/test_GenesisBlock.py | test_genesis_block_values | TestGenesisBlock | 23 | null |
theQRL/QRL | from unittest import TestCase
from mock import Mock, patch
from qrl.core import config
from qrl.core.ESyncState import ESyncState
from qrl.core.txs.SlaveTransaction import SlaveTransaction
from qrl.core.txs.TransferTransaction import TransferTransaction
from qrl.core.messagereceipt import MessageReceipt
from qrl.core... | mrData) | assert_* | variable | tests/core/p2p/test_p2pTxManagement.py | test_handle_message_received | TestP2PTxManagementHandlers | 145 | null |
theQRL/QRL | from unittest import TestCase
from mock import PropertyMock, patch
import random
from math import ceil
from qrl.core import config
from qrl.core.misc import logger
from qrl.core.State import State
from qrl.core.OptimizedAddressState import OptimizedAddressState
from qrl.core.PaginatedBitfield import PaginatedBitfield
... | 1) | self.assertEqual | numeric_literal | tests/core/test_PaginatedBitfield.py | test_unset_ots_key2 | TestPaginatedBitfield | 249 | null |
peteromallet/desloppify | from __future__ import annotations
from unittest.mock import MagicMock, patch
import pytest
from desloppify.app.commands.fix.options import _COMMAND_POST_FIX, _load_fixer
from desloppify.languages._framework.base.types import FixerConfig, LangConfig
def _make_fixer(name: str = "test_fixer", post_fix=None) -> FixerC... | fc | assert | variable | desloppify/tests/commands/fix/test_fix_options_io.py | test_load_fixer_returns_lang_and_fixer_config | 59 | null | |
peteromallet/desloppify | import json
import pytest
from desloppify.core.config import (
CONFIG_SCHEMA,
_migrate_from_state_files,
add_ignore_pattern,
config_for_query,
default_config,
load_config,
save_config,
set_config_value,
set_ignore_metadata,
unset_config_value,
)
class TestConfigForQuery:
d... | q | assert | variable | desloppify/tests/core/test_config.py | test_returns_all_keys | TestConfigForQuery | 262 | null |
peteromallet/desloppify | import textwrap
from pathlib import Path
from desloppify.languages.python.detectors.mutable_state import (
detect_global_mutable_config,
)
def _write_py(tmp_path: Path, code: str, filename: str = "mod.py") -> Path:
f = tmp_path / filename
f.write_text(textwrap.dedent(code))
return tmp_path
def _names... | e | assert | variable | desloppify/languages/python/tests/test_py_mutable_state.py | test_entry_keys | TestOutputStructure | 231 | null |
peteromallet/desloppify | from pathlib import Path
import pytest
import desloppify.languages.typescript.detectors.concerns as concerns_detector_mod
def _root(tmp_path, set_project_root, monkeypatch):
"""Point PROJECT_ROOT at the tmp directory via RuntimeContext."""
monkeypatch.setattr(concerns_detector_mod, "PROJECT_ROOT", tmp_path)
... | [] | assert | collection | desloppify/languages/typescript/tests/test_ts_concerns.py | test_empty_directory | TestDetectMixedConcerns | 139 | null |
peteromallet/desloppify | from __future__ import annotations
from desloppify.languages.python.detectors.facade import (
detect_reexport_facades,
is_py_facade,
)
def _make_graph_entry(importer_count: int = 0) -> dict:
return {
"imports": set(),
"importers": set(),
"import_count": 0,
"importer_count":... | [] | assert | collection | desloppify/languages/python/tests/test_py_facade.py | test_non_facade_file_not_detected | TestDetectReexportFacades | 91 | null |
peteromallet/desloppify | import textwrap
from pathlib import Path
from desloppify.languages.python.detectors.deps import (
build_dep_graph,
find_python_dynamic_imports,
)
def _make_pkg(tmp_path: Path, files: dict[str, str]) -> Path:
"""Create a Python package directory structure.
Args:
tmp_path: pytest temp directory... | 3 | assert | numeric_literal | desloppify/languages/python/tests/test_py_deps.py | test_multi_file_graph | TestBasicGraph | 111 | null |
peteromallet/desloppify | from desloppify.languages.typescript import TypeScriptConfig
def test_config_phases_non_empty():
"""TypeScriptConfig.phases is a non-empty list."""
cfg = TypeScriptConfig()
assert len(cfg.phases) > | 0 | assert | numeric_literal | desloppify/languages/typescript/tests/test_ts_init.py | test_config_phases_non_empty | 36 | null | |
peteromallet/desloppify | from pathlib import Path
import pytest
import desloppify.languages.typescript.detectors.react as react_detector_mod
from desloppify.languages.typescript.detectors.react import (
_count_return_fields,
detect_context_nesting,
detect_hook_return_bloat,
detect_state_sync,
)
def _root(tmp_path, set_projec... | 0 | assert | numeric_literal | desloppify/languages/typescript/tests/test_ts_react.py | test_skips_useeffect_with_non_setter_statements | TestDetectStateSync | 73 | null |
peteromallet/desloppify | from __future__ import annotations
import json
from pathlib import Path
from types import SimpleNamespace
from unittest.mock import patch
import desloppify.languages.typescript.detectors.exports as exports_mod
def _make_args(path: str = "/tmp/fake", json_output: bool = False, top: int = 10):
return SimpleNamespa... | err | assert | variable | desloppify/languages/typescript/tests/test_ts_exports_detector.py | test_cmd_exports_prints_scanning_message | 150 | null | |
peteromallet/desloppify | from __future__ import annotations
import json
import logging
import desloppify.core.fallbacks as fallbacks_mod
import desloppify.core.query as query_mod
def test_log_best_effort_failure_debugs(caplog):
logger = logging.getLogger("desloppify.tests.core_direct")
with caplog.at_level(logging.DEBUG, logger=log... | caplog.text | assert | complex_expr | desloppify/tests/core/test_core_direct.py | test_log_best_effort_failure_debugs | 70 | null | |
peteromallet/desloppify | from __future__ import annotations
import json
from pathlib import Path
from types import SimpleNamespace
from unittest.mock import patch
import desloppify.languages.typescript.detectors.exports as exports_mod
def _make_args(path: str = "/tmp/fake", json_output: bool = False, top: int = 10):
return SimpleNamespa... | out | assert | variable | desloppify/languages/typescript/tests/test_ts_exports_detector.py | test_cmd_exports_no_dead_exports | 72 | null | |
peteromallet/desloppify | from desloppify.engine.detectors.base import (
ClassInfo,
ComplexitySignal,
FunctionInfo,
GodRule,
)
def test_function_info_defaults():
"""FunctionInfo optional fields have correct defaults."""
fi = FunctionInfo(name="f", file="x.py", line=1, end_line=2, loc=2, body="")
assert fi.normalize... | "" | assert | string_literal | desloppify/tests/detectors/test_base.py | test_function_info_defaults | 29 | null | |
peteromallet/desloppify | from desloppify.languages.typescript import TypeScriptConfig
def test_config_default_src():
"""TypeScriptConfig.default_src is 'src'."""
cfg = TypeScriptConfig()
assert cfg.default_src == | "src" | assert | string_literal | desloppify/languages/typescript/tests/test_ts_init.py | test_config_default_src | 30 | null | |
peteromallet/desloppify | from pathlib import Path
import pytest
import desloppify.languages.typescript.detectors.deprecated as deprecated_detector_mod
import desloppify.utils as utils_mod
def _root(tmp_path, set_project_root, monkeypatch):
"""Point PROJECT_ROOT at the tmp directory via RuntimeContext."""
monkeypatch.setattr(utils_mo... | 1 | assert | numeric_literal | desloppify/languages/typescript/tests/test_ts_deprecated.py | test_finds_deprecated_annotations | TestDetectDeprecated | 146 | null |
peteromallet/desloppify | from __future__ import annotations
from types import SimpleNamespace
from unittest.mock import MagicMock, patch
import pytest
from desloppify.app.commands.review.helpers import parse_dimensions
from desloppify.app.commands.review.preflight import (
_scored_dimensions,
clear_stale_subjective_entries,
revi... | nq | assert | variable | desloppify/tests/commands/test_review_preflight.py | test_clears_stale_entries | 400 | null | |
peteromallet/desloppify | from __future__ import annotations
from pathlib import Path
from unittest.mock import patch
from desloppify.languages.go.extractors import (
extract_functions,
extract_go_functions,
normalize_go_body,
)
def _write_go_file(tmp_path: Path, name: str, content: str) -> str:
f = tmp_path / name
f.writ... | [] | assert | collection | desloppify/languages/go/tests/test_extractors.py | test_extract_nonexistent_file | 233 | null | |
peteromallet/desloppify | import shutil
from desloppify.engine.policy.zones import Zone
from desloppify.languages.python import (
PY_COMPLEXITY_SIGNALS,
PY_ENTRY_PATTERNS,
PY_GOD_RULES,
PY_SKIP_NAMES,
PY_ZONE_RULES,
PythonConfig,
)
class TestComplexitySignals:
def test_all_have_weight(self):
for s in PY_CO... | 1 | assert | numeric_literal | desloppify/languages/python/tests/test_py_init.py | test_all_have_weight | TestComplexitySignals | 107 | null |
peteromallet/desloppify | from __future__ import annotations
import desloppify.app.cli_support.parser as cli_parser
import desloppify.app.cli_support.parser_groups as cli_parser_groups
import desloppify.app.commands.config_cmd as config_cmd
import desloppify.app.commands.move.move_directory as move_directory
import desloppify.app.commands.move... | True | assert | bool_literal | desloppify/tests/commands/test_direct_coverage_modules.py | test_private_imports_is_dunder | 337 | null | |
peteromallet/desloppify | import textwrap
from desloppify.languages.python.detectors import complexity as complexity_mod
from desloppify.languages.python.detectors.complexity import (
compute_long_functions,
compute_max_params,
compute_nesting_depth,
)
class TestComputeMaxParams:
def test_multiple_functions_returns_max(self):... | 9 | assert | numeric_literal | desloppify/languages/python/tests/test_py_complexity.py | test_multiple_functions_returns_max | TestComputeMaxParams | 57 | null |
peteromallet/desloppify | import textwrap
from pathlib import Path
from desloppify.languages.python.extractors import (
detect_passthrough_functions,
extract_py_classes,
extract_py_functions,
extract_py_params,
normalize_py_body,
)
def _write_py(tmp_path: Path, code: str, filename: str = "test_mod.py") -> str:
"""Write... | [] | assert | collection | desloppify/languages/python/tests/test_py_extractors.py | test_nonexistent_file_returns_empty | TestExtractPyFunctions | 139 | null |
peteromallet/desloppify | from __future__ import annotations
import pytest
from desloppify.intelligence.narrative.dimensions import (
_analyze_debt,
_analyze_dimensions,
)
from desloppify.intelligence.narrative.phase import _detect_milestone, _detect_phase
from desloppify.intelligence.narrative.strategy_engine import (
compute_fix... | str(result) | assert | func_call | desloppify/tests/core/test_narrative_strategy.py | test_groups_by_detector | TestOpenFilesByDetector | 49 | null |
peteromallet/desloppify | from __future__ import annotations
import json
from pathlib import Path
from types import SimpleNamespace
from desloppify.languages.csharp.deps.cli import cmd_cycles, cmd_deps
def _make_args(path="/fake/project", file=None, json_flag=False, top=20, **extra):
"""Build a SimpleNamespace that looks like argparse ou... | 2 | assert | numeric_literal | desloppify/languages/csharp/tests/test_csharp_deps_cli.py | test_cmd_deps_overview_json_output | 146 | null | |
peteromallet/desloppify | import textwrap
from pathlib import Path
from desloppify.languages.python.detectors import dict_keys as dict_keys_mod
from desloppify.languages.python.detectors.dict_keys import (
detect_dict_key_flow,
detect_schema_drift,
)
def _write_py(tmp_path: Path, code: str, filename: str = "test_mod.py") -> Path:
... | 2 | assert | numeric_literal | desloppify/languages/python/tests/test_py_dict_keys.py | test_swap | TestLevenshtein | 46 | null |
peteromallet/desloppify | from pathlib import Path
from desloppify.languages.python.detectors.coupling_contracts import (
detect_implicit_mixin_contracts,
)
def _write(tmp_path: Path, rel: str, content: str) -> Path:
path = tmp_path / rel
path.parent.mkdir(parents=True, exist_ok=True)
path.write_text(content)
return path
... | 1 | assert | numeric_literal | desloppify/languages/python/tests/test_py_coupling_contracts.py | test_detects_implicit_mixin_contract_dependencies | 28 | null | |
peteromallet/desloppify | from pathlib import Path
from desloppify.languages.python.detectors.coupling_contracts import (
detect_implicit_mixin_contracts,
)
def _write(tmp_path: Path, rel: str, content: str) -> Path:
path = tmp_path / rel
path.parent.mkdir(parents=True, exist_ok=True)
path.write_text(content)
return path
... | [] | assert | collection | desloppify/languages/python/tests/test_py_coupling_contracts.py | test_ignores_mixin_with_declared_contract_or_writes | 50 | null | |
peteromallet/desloppify | import textwrap
from desloppify.languages.python.detectors import complexity as complexity_mod
from desloppify.languages.python.detectors.complexity import (
compute_long_functions,
compute_max_params,
compute_nesting_depth,
)
class TestComputeMaxParams:
def test_nested_parens_handled(self):
... | 8 | assert | numeric_literal | desloppify/languages/python/tests/test_py_complexity.py | test_nested_parens_handled | TestComputeMaxParams | 70 | null |
peteromallet/desloppify | from __future__ import annotations
import desloppify.languages.typescript.move as ts_move
class TestMoveTsHelpers:
def test_compute_ts_specifiers_relative(self):
alias, relative = ts_move._compute_ts_specifiers(
"/project/src/a.ts", "/project/src/b.ts"
)
assert relative == | "./b" | assert | string_literal | desloppify/languages/typescript/tests/test_ts_move.py | test_compute_ts_specifiers_relative | TestMoveTsHelpers | 26 | null |
peteromallet/desloppify | from __future__ import annotations
from desloppify.engine.policy.zones import FileZoneMap, Zone
from desloppify.hook_registry import get_lang_hook
from desloppify.languages import get_lang
def test_go_test_files_classified_as_test_zone():
cfg = get_lang("go")
zone_map = FileZoneMap(
["pkg/foo.go", "pk... | Zone.TEST | assert | complex_expr | desloppify/languages/go/tests/test_init.py | test_go_test_files_classified_as_test_zone | 59 | null | |
peteromallet/desloppify | import textwrap
from pathlib import Path
from desloppify.languages.python.detectors.deps import (
build_dep_graph,
find_python_dynamic_imports,
)
def _make_pkg(tmp_path: Path, files: dict[str, str]) -> Path:
"""Create a Python package directory structure.
Args:
tmp_path: pytest temp directory... | None | assert | none_literal | desloppify/languages/python/tests/test_py_deps.py | test_simple_relative_import | TestBasicGraph | 68 | null |
peteromallet/desloppify | from __future__ import annotations
from pathlib import Path
from unittest.mock import patch
from desloppify.languages.gdscript.detectors.deps import build_dep_graph
def _write(path: Path, relpath: str, content: str) -> Path:
file_path = path / relpath
file_path.parent.mkdir(parents=True, exist_ok=True)
f... | set() | assert | func_call | desloppify/tests/lang/gdscript/test_gdscript_deps.py | test_build_dep_graph_ignores_non_gd_paths | 56 | null | |
peteromallet/desloppify | import textwrap
from desloppify.languages.python.detectors import complexity as complexity_mod
from desloppify.languages.python.detectors.complexity import (
compute_long_functions,
compute_max_params,
compute_nesting_depth,
)
class TestDetectIndentUnit:
def test_tab_counted_as_chars(self):
l... | 1 | assert | numeric_literal | desloppify/languages/python/tests/test_py_complexity.py | test_tab_counted_as_chars | TestDetectIndentUnit | 187 | null |
peteromallet/desloppify | import desloppify.core.config as config_mod
from desloppify.app.commands.helpers.runtime import CommandRuntime
from desloppify.app.commands.zone_cmd import (
_zone_clear,
_zone_set,
_zone_show,
cmd_zone,
)
class TestZoneSet:
def test_valid_zone_value_saves(self, monkeypatch, capsys):
"""Se... | out | assert | variable | desloppify/tests/commands/test_cmd_zone.py | test_valid_zone_value_saves | TestZoneSet | 160 | null |
peteromallet/desloppify | import textwrap
from pathlib import Path
from desloppify.languages.python.detectors import dict_keys as dict_keys_mod
from desloppify.languages.python.detectors.dict_keys import (
detect_dict_key_flow,
detect_schema_drift,
)
def _write_py(tmp_path: Path, code: str, filename: str = "test_mod.py") -> Path:
... | f | assert | variable | desloppify/languages/python/tests/test_py_dict_keys.py | test_finding_keys | TestOutputStructure | 341 | null |
peteromallet/desloppify | from pathlib import Path
import pytest
import desloppify.languages.typescript.detectors.unused as ts_unused_mod
from desloppify.languages.typescript.detectors.unused import (
TS6133_RE,
TS6192_RE,
_categorize_unused,
detect_unused,
)
def _root(tmp_path, set_project_root, monkeypatch):
"""Point PR... | "1" | assert | string_literal | desloppify/languages/typescript/tests/test_ts_unused.py | test_ts6192_matches | TestErrorRegex | 71 | null |
peteromallet/desloppify | import textwrap
from pathlib import Path
from desloppify.languages.python.detectors.mutable_state import (
detect_global_mutable_config,
)
def _write_py(tmp_path: Path, code: str, filename: str = "mod.py") -> Path:
f = tmp_path / filename
f.write_text(textwrap.dedent(code))
return tmp_path
def _names... | 2 | assert | numeric_literal | desloppify/languages/python/tests/test_py_mutable_state.py | test_mutation_count | TestMultipleMutations | 214 | null |
peteromallet/desloppify | from __future__ import annotations
import json
from pathlib import Path
from types import SimpleNamespace
from unittest.mock import patch
import desloppify.languages.typescript.detectors.exports as exports_mod
def test_detect_dead_exports_returns_empty_when_knip_unavailable():
"""Returns ([], 0) when Knip is not... | [] | assert | collection | desloppify/languages/typescript/tests/test_ts_exports_detector.py | test_detect_dead_exports_returns_empty_when_knip_unavailable | 19 | null | |
peteromallet/desloppify | from pathlib import Path
import pytest
from desloppify.languages.typescript.detectors.patterns import (
PATTERN_FAMILIES,
_build_census,
detect_pattern_anomalies,
)
def _root(set_project_root):
"""Point PROJECT_ROOT at the tmp directory via RuntimeContext."""
def _write(tmp_path: Path, name: str, co... | 1 | assert | numeric_literal | desloppify/languages/typescript/tests/test_ts_patterns.py | test_fragmentation_detected_with_enough_areas | TestDetectPatternAnomalies | 125 | null |
peteromallet/desloppify | import textwrap
from pathlib import Path
from desloppify.languages.python.detectors import smells as smells_mod
from desloppify.languages.python.detectors.smells import (
detect_smells,
)
def _write_py(tmp_path: Path, code: str, filename: str = "test_mod.py") -> Path:
"""Write a Python file and return the dir... | ids | assert | variable | desloppify/languages/python/tests/test_py_smells.py | test_import_time_boundary_mutations_detected | TestBoundaryPurity | 786 | null |
peteromallet/desloppify | import textwrap
from pathlib import Path
from desloppify.languages.python.detectors import smells as smells_mod
from desloppify.languages.python.detectors.smells import (
detect_smells,
)
def _write_py(tmp_path: Path, code: str, filename: str = "test_mod.py") -> Path:
"""Write a Python file and return the dir... | 1 | assert | numeric_literal | desloppify/languages/python/tests/test_py_smells.py | test_clean_file | TestCleanCode | 511 | null |
peteromallet/desloppify | import re
import textwrap
from desloppify.languages.typescript.extractors import (
_extract_ts_params,
_parse_param_names,
extract_props,
extract_ts_functions,
normalize_ts_body,
tsx_passthrough_pattern,
)
def test_extract_named_function(tmp_path):
"""Named function declaration is extracte... | 1 | assert | numeric_literal | desloppify/languages/typescript/tests/test_ts_extractors.py | test_extract_named_function | 139 | null | |
peteromallet/desloppify | from pathlib import Path
import pytest
import desloppify.languages.typescript.detectors.deprecated as deprecated_detector_mod
import desloppify.utils as utils_mod
def _root(tmp_path, set_project_root, monkeypatch):
"""Point PROJECT_ROOT at the tmp directory via RuntimeContext."""
monkeypatch.setattr(utils_mo... | [] | assert | collection | desloppify/languages/typescript/tests/test_ts_deprecated.py | test_empty_directory | TestDetectDeprecated | 172 | null |
peteromallet/desloppify | from pathlib import Path
import pytest
from desloppify.languages.typescript.detectors.logs import TAG_EXTRACT_RE, detect_logs
def _root(set_project_root):
"""Point PROJECT_ROOT at the tmp directory via RuntimeContext."""
def _write(tmp_path: Path, name: str, content: str) -> Path:
p = tmp_path / name
p.... | 1 | assert | numeric_literal | desloppify/languages/typescript/tests/test_ts_logs.py | test_detects_tagged_console_log | TestDetectLogs | 31 | null |
peteromallet/desloppify | from __future__ import annotations
from desloppify.languages.csharp._parse_helpers import (
extract_csharp_params,
extract_csharp_return_annotation,
find_expression_end,
find_matching_brace,
split_params,
)
def test_find_matching_brace_empty_body():
content = "{}"
assert find_matching_bra... | 1 | assert | numeric_literal | desloppify/languages/csharp/tests/test_csharp_parse_helpers.py | test_find_matching_brace_empty_body | 60 | null | |
peteromallet/desloppify | from __future__ import annotations
from desloppify.engine._plan.reconcile import reconcile_plan_after_scan
from desloppify.engine._plan.schema import empty_plan
from desloppify.engine._plan.stale_dimensions import sync_stale_dimensions
def _plan_with_queue(*ids: str) -> dict:
plan = empty_plan()
plan["queue_o... | result.pruned | assert | complex_expr | desloppify/tests/plan/test_stale_dimensions.py | test_prune_does_not_touch_real_finding_ids | 120 | null | |
peteromallet/desloppify | import inspect
import desloppify.engine.planning.core as plan_mod
from desloppify.app.commands import plan_cmd
from desloppify.app.commands.plan_cmd import cmd_plan_output
class TestCmdPlanOutput:
def test_no_scan_prints_warning(self, monkeypatch, capsys):
"""When no scan has been performed, should print... | "" | assert | string_literal | desloppify/tests/commands/test_cmd_plan.py | test_no_scan_prints_warning | TestCmdPlanOutput | 61 | null |
peteromallet/desloppify | from __future__ import annotations
from desloppify.languages.python.detectors.facade import (
detect_reexport_facades,
is_py_facade,
)
def _make_graph_entry(importer_count: int = 0) -> dict:
return {
"imports": set(),
"importers": set(),
"import_count": 0,
"importer_count":... | 0 | assert | numeric_literal | desloppify/languages/python/tests/test_py_facade.py | test_empty_graph | TestDetectReexportFacades | 115 | null |
peteromallet/desloppify | import textwrap
from pathlib import Path
from desloppify.languages.python.detectors.mutable_state import (
detect_global_mutable_config,
)
def _write_py(tmp_path: Path, code: str, filename: str = "mod.py") -> Path:
f = tmp_path / filename
f.write_text(textwrap.dedent(code))
return tmp_path
def _names... | 1 | assert | numeric_literal | desloppify/languages/python/tests/test_py_mutable_state.py | test_list_mutated | TestBasicDetection | 34 | null |
peteromallet/desloppify | from pathlib import Path
import pytest
from desloppify.languages.typescript.detectors.logs import TAG_EXTRACT_RE, detect_logs
def _root(set_project_root):
"""Point PROJECT_ROOT at the tmp directory via RuntimeContext."""
def _write(tmp_path: Path, name: str, content: str) -> Path:
p = tmp_path / name
p.... | [] | assert | collection | desloppify/languages/typescript/tests/test_ts_logs.py | test_empty_directory | TestDetectLogs | 99 | null |
peteromallet/desloppify | from __future__ import annotations
from desloppify.engine._work_queue.helpers import scope_matches
def _item(*, id: str, detector: str = "smells", file: str = "a.py") -> dict:
return {
"id": id,
"detector": detector,
"file": file,
"summary": "test finding",
"detail": {},
... | True | assert | bool_literal | desloppify/tests/commands/test_scope_matches.py | test_hash_suffix_matches | TestHashSuffixMatching | 22 | null |
peteromallet/desloppify | from desloppify.languages.typescript import TypeScriptConfig
def test_config_exclusions():
"""TypeScriptConfig.exclusions includes node_modules and .d.ts."""
cfg = TypeScriptConfig()
assert "node_modules" in | cfg.exclusions | assert | complex_expr | desloppify/languages/typescript/tests/test_ts_init.py | test_config_exclusions | 23 | null | |
peteromallet/desloppify | import textwrap
from desloppify.languages.typescript.fixers import __all__
from desloppify.languages.typescript.fixers.common import (
apply_fixer,
collapse_blank_lines,
extract_body_between_braces,
find_balanced_end,
)
from desloppify.languages.typescript.fixers.if_chain import (
_find_if_chain_en... | 0 | assert | numeric_literal | desloppify/languages/typescript/tests/test_ts_fixers.py | test_single_line_parens | TestCommonFindBalancedEnd | 73 | null |
peteromallet/desloppify | from __future__ import annotations
from desloppify.languages.csharp._parse_helpers import (
extract_csharp_params,
extract_csharp_return_annotation,
find_expression_end,
find_matching_brace,
split_params,
)
def test_split_params_empty():
assert split_params("") == | [] | assert | collection | desloppify/languages/csharp/tests/test_csharp_parse_helpers.py | test_split_params_empty | 115 | null | |
peteromallet/desloppify | from __future__ import annotations
from pathlib import Path
from types import SimpleNamespace
import desloppify.languages.typescript.phases as phases
from desloppify.engine.detectors.coupling import CouplingEdgeCounts
def test_phase_structural_uses_lang_thresholds(monkeypatch, tmp_path: Path):
"""Structural phas... | 2 | assert | numeric_literal | desloppify/languages/typescript/tests/test_ts_phases.py | test_phase_structural_uses_lang_thresholds | 87 | null | |
peteromallet/desloppify | from __future__ import annotations
from pathlib import Path
import desloppify.languages.python.move as py_move
class TestMovePyHelpers:
def test_path_to_py_module_outside_root(self):
root = Path("/project")
assert py_move._path_to_py_module("/other/foo.py", root) is | None | assert | none_literal | desloppify/languages/python/tests/test_py_move.py | test_path_to_py_module_outside_root | TestMovePyHelpers | 26 | null |
peteromallet/desloppify | from pathlib import Path
import pytest
import desloppify.languages.typescript.detectors.concerns as concerns_detector_mod
def _root(tmp_path, set_project_root, monkeypatch):
"""Point PROJECT_ROOT at the tmp directory via RuntimeContext."""
monkeypatch.setattr(concerns_detector_mod, "PROJECT_ROOT", tmp_path)
... | 1 | assert | numeric_literal | desloppify/languages/typescript/tests/test_ts_concerns.py | test_detects_mixed_jsx_fetch_transforms | TestDetectMixedConcerns | 53 | null |
peteromallet/desloppify | from pathlib import Path
import pytest
import desloppify.languages.typescript.detectors.props as props_detector_mod
from desloppify.languages.typescript.detectors.props import detect_prop_interface_bloat
def _root(tmp_path, set_project_root, monkeypatch):
"""Point PROJECT_ROOT at the tmp directory via RuntimeCon... | [] | assert | collection | desloppify/languages/typescript/tests/test_ts_props.py | test_empty_directory | TestDetectPropInterfaceBloat | 103 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.