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
MolecularAI/aizynthfinder
import pytest from aizynthfinder.context.collection import ContextCollection def test_get_item(): collection = StringCollection() collection.load("key1", "value1") assert collection["key1"] ==
"value1"
assert
string_literal
tests/context/test_collection.py
test_get_item
40
null
MolecularAI/aizynthfinder
import pytest from aizynthfinder.reactiontree import ReactionTree def test_mcts_route_to_reactiontree(setup_linear_mcts, load_reaction_tree): def remove_metadata(tree_dict): if "metadata" in tree_dict: tree_dict["metadata"] = {} for child in tree_dict.get("children", []): r...
2
assert
numeric_literal
tests/test_reactiontree.py
test_mcts_route_to_reactiontree
23
null
MolecularAI/aizynthfinder
import glob import json import os import sys from typing import Dict, List import pandas as pd import pytest import yaml from aizynthfinder.analysis import RouteCollection from aizynthfinder.chem import MoleculeException from aizynthfinder.interfaces import AiZynthApp from aizynthfinder.interfaces.aizynthapp import m...
policies
assert
variable
tests/test_cli.py
test_download_public_data
440
null
MolecularAI/aizynthfinder
def test_route_to_node(setup_complete_mcts_tree): tree, nodes = setup_complete_mcts_tree actions, route_nodes = nodes[2].path_to() assert len(actions) ==
2
assert
numeric_literal
tests/mcts/test_tree.py
test_route_to_node
36
null
MolecularAI/aizynthfinder
import os import gzip import json import pytest import pandas as pd from aizynthfinder.utils.files import ( cat_datafiles, split_file, start_processes, read_datafile, save_datafile, ) def create_dummy_file(tmpdir, mocker): patched_tempfile = mocker.patch("aizynthfinder.utils.files.tempfile.mk...
"f\ng"
assert
string_literal
tests/utils/test_file_utils.py
test_split_file_odd
63
null
MolecularAI/aizynthfinder
import numpy as np import networkx as nx from aizynthfinder.search.retrostar.nodes import MoleculeNode from aizynthfinder.chem.serialization import MoleculeSerializer, MoleculeDeserializer from aizynthfinder.search.andor_trees import ReactionTreeFromAndOrTrace def test_serialization_deserialization( setup_star_ro...
root.cost
assert
complex_expr
tests/retrostar/test_retrostar_nodes.py
test_serialization_deserialization
105
null
MolecularAI/aizynthfinder
import os from tarfile import TarFile import numpy as np import pytest from aizynthfinder.analysis import TreeAnalysis, RouteCollection from aizynthfinder.analysis.routes import SUPPORT_CLUSTERING from aizynthfinder.analysis.utils import RouteSelectionArguments from aizynthfinder.reactiontree import ReactionTree from...
1
assert
numeric_literal
tests/test_analysis.py
test_sort_nodes_return_all
52
null
MolecularAI/aizynthfinder
import pytest from aizynthfinder.search.breadth_first.nodes import MoleculeNode from aizynthfinder.chem.serialization import MoleculeSerializer, MoleculeDeserializer def setup_root(default_config): def wrapper(smiles): return MoleculeNode.create_root(smiles, config=default_config) return wrapper def...
reaction.metadata
assert
complex_expr
tests/breadth_first/test_nodes.py
test_serialization_deserialization
72
null
MolecularAI/aizynthfinder
import pytest from aizynthfinder.search.mcts.node import ParetoMctsNode from aizynthfinder.search.mcts import MctsSearchTree def generate_root(default_config): def wrapper(smiles, config=None): return ParetoMctsNode.create_root( smiles, tree=None, config=config or default_config ) ...
[0.0, 0.0]
assert
collection
tests/mcts/test_multiobjective.py
test_setup_mo_tree
102
null
MolecularAI/aizynthfinder
import numpy as np import networkx as nx from aizynthfinder.search.retrostar.nodes import MoleculeNode from aizynthfinder.chem.serialization import MoleculeSerializer, MoleculeDeserializer from aizynthfinder.search.andor_trees import ReactionTreeFromAndOrTrace def test_create_root_node(setup_star_root): node = se...
{node.mol}
assert
collection
tests/retrostar/test_retrostar_nodes.py
test_create_root_node
13
null
MolecularAI/aizynthfinder
import os import gzip import json import pytest import pandas as pd from aizynthfinder.utils.files import ( cat_datafiles, split_file, start_processes, read_datafile, save_datafile, ) def create_dummy_file(tmpdir, mocker): patched_tempfile = mocker.patch("aizynthfinder.utils.files.tempfile.mk...
data2.columns.to_list()
assert
func_call
tests/utils/test_file_utils.py
test_save_load_datafile_roundtrip
144
null
MolecularAI/aizynthfinder
from aizynthfinder.chem.serialization import MoleculeSerializer, MoleculeDeserializer from aizynthfinder.chem import Molecule, TreeMolecule def test_empty_store(): serializer = MoleculeSerializer() assert serializer.store ==
{}
assert
collection
tests/chem/test_serialization.py
test_empty_store
8
null
MolecularAI/aizynthfinder
import pytest from aizynthfinder.search.dfpn.nodes import MoleculeNode, BIG_INT from aizynthfinder.search.dfpn import SearchTree def setup_root(default_config): def wrapper(smiles): owner = SearchTree(default_config) return MoleculeNode.create_root(smiles, config=default_config, owner=owner) ...
1
assert
numeric_literal
tests/dfpn/test_nodes.py
test_create_root_node
21
null
MolecularAI/aizynthfinder
from aizynthfinder.chem import ( FixedRetroReaction, SmilesBasedRetroReaction, TemplatedRetroReaction, TreeMolecule, UniqueMolecule, hash_reactions, ) def test_smiles_based_retroreaction(): mol = TreeMolecule(smiles="CNC(C)=O", parent=None) reaction = SmilesBasedRetroReaction(mol, react...
1
assert
numeric_literal
tests/chem/test_reaction.py
test_smiles_based_retroreaction
90
null
MolecularAI/aizynthfinder
import pytest from aizynthfinder.context.collection import ContextCollection def test_select_single_item(): collection = StringCollection() collection.load("key1", "value1") collection.selection = "key1" assert collection.selection == ["key1"] with pytest.raises(KeyError): collection.se...
["key2"]
assert
collection
tests/context/test_collection.py
test_select_single_item
73
null
MolecularAI/aizynthfinder
import os import gzip import json import pytest import pandas as pd from aizynthfinder.utils.files import ( cat_datafiles, split_file, start_processes, read_datafile, save_datafile, ) def create_dummy_file(tmpdir, mocker): patched_tempfile = mocker.patch("aizynthfinder.utils.files.tempfile.mk...
4
assert
numeric_literal
tests/utils/test_file_utils.py
test_cat_hdf
92
null
crazyguitar/pysheeet
import csv import gzip import json import tempfile import zipfile from pathlib import Path def test_zipfile_create_extract(tmp_path): """Create and extract zip archives.""" zip_path = tmp_path / "archive.zip" file1 = tmp_path / "file1.txt" file1.write_text("content 1") # Create zip with zipfil...
names
assert
variable
src/basic/fileio_.py
test_zipfile_create_extract
267
null
crazyguitar/pysheeet
import pytest import hmac import secrets import os class TestCommandInjection: def test_vulnerable_shell_command(self): """INSECURE: User input in shell command.""" def build_command_insecure(filename): # VULNERABLE: Shell injection possible return f"cat {filename}" ...
cmd
assert
variable
src/security/vulnerability_.py
test_vulnerable_shell_command
TestCommandInjection
112
null
crazyguitar/pysheeet
import pytest import unicodedata def encode_utf8(s: str) -> bytes: """Encode string to UTF-8 bytes.""" return s.encode("utf-8") def decode_utf8(b: bytes) -> str: """Decode UTF-8 bytes to string.""" return b.decode("utf-8") def encode_with_errors(s: str, encoding: str, errors: str) -> bytes: """En...
s
assert
variable
src/basic/unicode_.py
test_roundtrip
TestEncodingDecoding
85
null
crazyguitar/pysheeet
import socket import threading import time import pytest class TestIPConversion: def test_inet_ntop_ipv6(self): ip = socket.inet_ntop(socket.AF_INET6, b"\x00" * 15 + b"\x01") assert ip ==
"::1"
assert
string_literal
src/basic/socket_.py
test_inet_ntop_ipv6
TestIPConversion
80
null
crazyguitar/pysheeet
import pytest import unicodedata def encode_utf8(s: str) -> bytes: """Encode string to UTF-8 bytes.""" return s.encode("utf-8") def decode_utf8(b: bytes) -> str: """Decode UTF-8 bytes to string.""" return b.decode("utf-8") def encode_with_errors(s: str, encoding: str, errors: str) -> bytes: """En...
"Nd"
assert
string_literal
src/basic/unicode_.py
test_get_char_category
TestCharInfo
136
null
crazyguitar/pysheeet
import csv import gzip import json import tempfile import zipfile from pathlib import Path def test_list_directory(tmp_path): """List directory contents.""" (tmp_path / "file1.txt").touch() (tmp_path / "file2.txt").touch() (tmp_path / "subdir").mkdir() items = list(tmp_path.iterdir()) assert ...
3
assert
numeric_literal
src/basic/fileio_.py
test_list_directory
113
null
crazyguitar/pysheeet
import sys import threading from datetime import datetime import pytest class TestExample: def test_add(self): assert example.add(1, 2) == 3 assert example.add(-5, 10) == 5 assert example.add(0, 0) ==
0
assert
numeric_literal
src/cext/test_cext.py
test_add
TestExample
55
null
crazyguitar/pysheeet
from abc import ABC, abstractmethod from functools import total_ordering import pytest class TestSingleton: def test_singleton(self): Singleton._instance = None # reset a = Singleton() b = Singleton() assert a is
b
assert
variable
src/basic/object.py
test_singleton
TestSingleton
345
null
crazyguitar/pysheeet
import heapq import pytest def heapify_list(items: list) -> list: """Convert list to heap in-place.""" h = items.copy() heapq.heapify(h) return h def heap_push(h: list, item) -> list: """Push item onto heap.""" heapq.heappush(h, item) return h def heap_pop(h: list): """Pop smallest i...
"b"
assert
string_literal
src/basic/heap.py
test_push_pop
TestIndexedHeap
261
null
crazyguitar/pysheeet
import pytest def create_set_literal(): """Create set using literal syntax.""" return {1, 2, 3} def create_set_from_list(items: list) -> set: """Create set from list, removing duplicates.""" return set(items) def create_empty_set() -> set: """Create empty set.""" return set() def set_compreh...
[3, 1, 2]
assert
collection
src/basic/set.py
test_preserve_order
TestUniquify
176
null
crazyguitar/pysheeet
import sys import asyncio import pytest from dataclasses import dataclass, FrozenInstanceError PY_VERSION = sys.version_info[:2] def dict_merge(a: dict, b: dict) -> dict: """Merge dicts with | operator.""" return a | b def dict_update(a: dict, b: dict) -> dict: """Update dict in place with |= operator.""...
result
assert
variable
src/new_py3/py3.py
test_fstring_nested
TestPython312
143
null
crazyguitar/pysheeet
import sys import platform import pytest def get_version_info() -> tuple: """Get Python version info.""" return sys.version_info[:3] def get_version_string() -> str: """Get Python version as string.""" return platform.python_version() def check_version(major: int, minor: int) -> bool: """Check if...
(2, 1)
assert
collection
src/basic/basic.py
test_swap
TestAssignment
216
null
crazyguitar/pysheeet
import sys import platform import pytest def get_version_info() -> tuple: """Get Python version info.""" return sys.version_info[:3] def get_version_string() -> str: """Get Python version as string.""" return platform.python_version() def check_version(major: int, minor: int) -> bool: """Check if...
[2, 3, 4]
assert
collection
src/basic/basic.py
test_first_and_rest
TestAssignment
221
null
crazyguitar/pysheeet
import pytest def create_set_literal(): """Create set using literal syntax.""" return {1, 2, 3} def create_set_from_list(items: list) -> set: """Create set from list, removing duplicates.""" return set(items) def create_empty_set() -> set: """Create empty set.""" return set() def set_compreh...
2
assert
numeric_literal
src/basic/set.py
test_pop
TestAddRemove
206
null
crazyguitar/pysheeet
import pytest import hmac import secrets import os class TestPickleVulnerability: def test_safe_json(self): """SECURE: JSON cannot execute code.""" import json data = {"user": "alice", "role": "admin"} serialized = json.dumps(data) deserialized = json.loads(serialized) ...
data
assert
variable
src/security/vulnerability_.py
test_safe_json
TestPickleVulnerability
162
null
crazyguitar/pysheeet
import pytest from typing import ( Optional, Union, Callable, TypeVar, Generic, Protocol, TypedDict, Literal, Final, ClassVar, ) def greet(name: str) -> str: """Function with type annotations.""" return f"Hello, {name}!" def add(a: int, b: int) -> int: """Add two in...
"42"
assert
string_literal
src/basic/typing_.py
test_process
TestOptionalUnion
177
null
crazyguitar/pysheeet
import inspect from contextlib import contextmanager from types import GeneratorType import pytest def simple_gen(): """Simple generator yielding values.""" yield 1 yield 2 yield 3 def countdown(n: int): """Countdown generator.""" while n > 0: yield n n -= 1 def fibonacci(n: ...
1
assert
numeric_literal
src/basic/generator.py
test_throw
TestThrowClose
250
null
crazyguitar/pysheeet
import re from collections import namedtuple import pytest def search_pattern(pattern: str, text: str) -> str | None: """Find first match of pattern in text.""" m = re.search(pattern, text) return m.group() if m else None def match_start(pattern: str, text: str) -> bool: """Check if text starts with ...
None
assert
none_literal
src/basic/rexp.py
test_search
TestBasicMatching
228
null
crazyguitar/pysheeet
import pytest import time from threading import Thread, Lock, RLock, Semaphore, Event, Condition, Barrier from queue import Queue from concurrent.futures import ThreadPoolExecutor, as_completed def _mp_square(x): return x * x def _mp_add(a, b): return a + b def _mp_worker(q, n): q.put(n * n) def _mp_inc...
3
assert
numeric_literal
src/basic/concurrency_.py
test_semaphore
TestThreading
124
null
crazyguitar/pysheeet
import pytest import unicodedata def encode_utf8(s: str) -> bytes: """Encode string to UTF-8 bytes.""" return s.encode("utf-8") def decode_utf8(b: bytes) -> str: """Decode UTF-8 bytes to string.""" return b.decode("utf-8") def encode_with_errors(s: str, encoding: str, errors: str) -> bytes: """En...
"Ll"
assert
string_literal
src/basic/unicode_.py
test_get_char_category
TestCharInfo
135
null
crazyguitar/pysheeet
import csv import gzip import json import tempfile import zipfile from pathlib import Path def test_shutil_which(): """Find executable in PATH.""" import shutil python = shutil.which("python") assert python is not
None
assert
none_literal
src/basic/fileio_.py
test_shutil_which
429
null
crazyguitar/pysheeet
import asyncio import pytest class TestSubprocess: def test_subprocess(self): """Test running subprocess.""" async def main(): proc = await asyncio.create_subprocess_shell( "echo hello", stdout=asyncio.subprocess.PIPE, stderr=asyncio.sub...
0
assert
numeric_literal
src/basic/asyncio_.py
test_subprocess
TestSubprocess
383
null
crazyguitar/pysheeet
from functools import lru_cache, partial, reduce, singledispatch, wraps import pytest def greet(name: str, greeting: str = "Hello") -> str: """Greet with optional greeting.""" return f"{greeting}, {name}!" def good_default(items=None): """Correct way to use mutable default.""" if items is None: ...
6
assert
numeric_literal
src/basic/func.py
test_keyword_only
TestKeywordOnly
229
null
crazyguitar/pysheeet
import calendar import time from datetime import date, datetime, time as dt_time, timedelta, timezone def test_business_days(): """Generate business days (skip weekends).""" def business_days(start, end): current = start while current <= end: if current.weekday() < 5: ...
5
assert
numeric_literal
src/basic/datetime_.py
test_business_days
245
null
crazyguitar/pysheeet
import pytest import unicodedata def encode_utf8(s: str) -> bytes: """Encode string to UTF-8 bytes.""" return s.encode("utf-8") def decode_utf8(b: bytes) -> str: """Decode UTF-8 bytes to string.""" return b.decode("utf-8") def encode_with_errors(s: str, encoding: str, errors: str) -> bytes: """En...
"Lu"
assert
string_literal
src/basic/unicode_.py
test_get_char_category
TestCharInfo
134
null
crazyguitar/pysheeet
import pytest import time from threading import Thread, Lock, RLock, Semaphore, Event, Condition, Barrier from queue import Queue from concurrent.futures import ThreadPoolExecutor, as_completed def _mp_square(x): return x * x def _mp_add(a, b): return a + b def _mp_worker(q, n): q.put(n * n) def _mp_inc...
0
assert
numeric_literal
src/basic/concurrency_.py
test_event
TestThreading
140
null
crazyguitar/pysheeet
import pytest import time from threading import Thread, Lock, RLock, Semaphore, Event, Condition, Barrier from queue import Queue from concurrent.futures import ThreadPoolExecutor, as_completed def _mp_square(x): return x * x def _mp_add(a, b): return a + b def _mp_worker(q, n): q.put(n * n) def _mp_inc...
[0, 1, 4]
assert
collection
src/basic/concurrency_.py
test_future_callback
TestConcurrentFutures
339
null
crazyguitar/pysheeet
import bisect import copy import itertools from collections import defaultdict, deque from functools import reduce import pytest def init_immutable(n: int) -> list: """Initialize list with immutable objects.""" return [0] * n def init_mutable(n: int) -> list: """Initialize list with mutable objects (corr...
[1, 0, 0]
assert
collection
src/basic/list.py
test_immutable
TestInitialize
115
null
crazyguitar/pysheeet
import heapq import pytest def heapify_list(items: list) -> list: """Convert list to heap in-place.""" h = items.copy() heapq.heapify(h) return h def heap_push(h: list, item) -> list: """Push item onto heap.""" heapq.heappush(h, item) return h def heap_pop(h: list): """Pop smallest i...
(3, "low")
assert
collection
src/basic/heap.py
test_priority_order
TestPriorityQueue
208
null
crazyguitar/pysheeet
import pytest from collections import defaultdict, OrderedDict from functools import lru_cache def create_dict_literal(): """Create dict using literal syntax.""" return {"key": "value", "num": 42} def create_dict_constructor(): """Create dict using constructor.""" return dict(key="value", num=42) def...
None
assert
none_literal
src/basic/dict.py
test_eviction
TestLRUCache
224
null
crazyguitar/pysheeet
import calendar import time from datetime import date, datetime, time as dt_time, timedelta, timezone def test_date_range(): """Generate date ranges.""" def date_range(start, end, step=timedelta(days=1)): current = start while current <= end: yield current current += st...
7
assert
numeric_literal
src/basic/datetime_.py
test_date_range
178
null
crazyguitar/pysheeet
import pytest import unicodedata def encode_utf8(s: str) -> bytes: """Encode string to UTF-8 bytes.""" return s.encode("utf-8") def decode_utf8(b: bytes) -> str: """Decode UTF-8 bytes to string.""" return b.decode("utf-8") def encode_with_errors(s: str, encoding: str, errors: str) -> bytes: """En...
"α"
assert
string_literal
src/basic/unicode_.py
test_lookup_char
TestCharInfo
140
null
crazyguitar/pysheeet
import pytest def create_set_literal(): """Create set using literal syntax.""" return {1, 2, 3} def create_set_from_list(items: list) -> set: """Create set from list, removing duplicates.""" return set(items) def create_empty_set() -> set: """Create empty set.""" return set() def set_compreh...
s
assert
variable
src/basic/set.py
test_in_set
TestFrozenset
261
null
crazyguitar/pysheeet
import pytest def create_set_literal(): """Create set using literal syntax.""" return {1, 2, 3} def create_set_from_list(items: list) -> set: """Create set from list, removing duplicates.""" return set(items) def create_empty_set() -> set: """Create empty set.""" return set() def set_compreh...
{2, 3}
assert
collection
src/basic/set.py
test_intersection
TestSetOperations
214
null
crazyguitar/pysheeet
import heapq import pytest def heapify_list(items: list) -> list: """Convert list to heap in-place.""" h = items.copy() heapq.heapify(h) return h def heap_push(h: list, item) -> list: """Push item onto heap.""" heapq.heappush(h, item) return h def heap_pop(h: list): """Pop smallest i...
1
assert
numeric_literal
src/basic/heap.py
test_heapify
TestBasicHeap
173
null
crazyguitar/pysheeet
import asyncio import pytest class TestExecutor: def test_run_in_executor(self): """Test run_in_executor for blocking code.""" import time def blocking(): time.sleep(0.01) return "done" async def main(): loop = asyncio.get_event_loop() ...
"done"
assert
string_literal
src/basic/asyncio_.py
test_run_in_executor
TestExecutor
363
null
crazyguitar/pysheeet
import pytest import sys import os build_dir = os.path.join(os.path.dirname(__file__), "build") class TestSimple: def test_fib(self): import simple assert simple.fib(0) == 0 assert simple.fib(1) ==
1
assert
numeric_literal
src/cext/capi/test_capi.py
test_fib
TestSimple
33
null
crazyguitar/pysheeet
import hashlib import hmac import os import secrets import pytest from cryptography.fernet import Fernet from cryptography.hazmat.primitives import hashes, serialization from cryptography.hazmat.primitives.asymmetric import rsa, padding, ed25519 from cryptography.hazmat.primitives.asymmetric.x25519 import X25519Privat...
token2
assert
variable
src/basic/crypto_.py
test_different_tokens
TestFernet
211
null
crazyguitar/pysheeet
import bisect import copy import itertools from collections import defaultdict, deque from functools import reduce import pytest def init_immutable(n: int) -> list: """Initialize list with immutable objects.""" return [0] * n def init_mutable(n: int) -> list: """Initialize list with mutable objects (corr...
3
assert
numeric_literal
src/basic/list.py
test_binary_search
TestBisect
289
null
crazyguitar/pysheeet
import pytest from sqlalchemy import ( create_engine, Column, Integer, String, ForeignKey, select, insert, func, desc, case, distinct, union_all, exists, text, ) from sqlalchemy.orm import ( declarative_base, sessionmaker, relationship, aliased, ) ...
3
assert
numeric_literal
src/basic/sqlalchemy_query.py
test_limit
TestLimitOffset
106
null
crazyguitar/pysheeet
import pytest from sqlalchemy import ( create_engine, Column, Integer, String, ForeignKey, Table, select, and_, or_, func, DateTime, event, ) from sqlalchemy.orm import ( declarative_base, sessionmaker, relationship, joinedload, ) from sqlalchemy.ext.hybri...
"CEO"
assert
string_literal
src/basic/sqlalchemy_orm.py
test_hierarchy
TestSelfReferential
413
null
crazyguitar/pysheeet
import sys import threading from datetime import datetime import pytest class TestVector: def test_add(self): v1 = vector.Vector2D(1, 2) v2 = vector.Vector2D(3, 4) v3 = v1 + v2 assert v3.x ==
4
assert
numeric_literal
src/cext/test_cext.py
test_add
TestVector
104
null
crazyguitar/pysheeet
import sys import platform import pytest def get_version_info() -> tuple: """Get Python version info.""" return sys.version_info[:3] def get_version_string() -> str: """Get Python version as string.""" return platform.python_version() def check_version(major: int, minor: int) -> bool: """Check if...
9
assert
numeric_literal
src/basic/basic.py
test_sum_odd_only
TestLoops
168
null
crazyguitar/pysheeet
import sys import asyncio import pytest from dataclasses import dataclass, FrozenInstanceError PY_VERSION = sys.version_info[:2] def dict_merge(a: dict, b: dict) -> dict: """Merge dicts with | operator.""" return a | b def dict_update(a: dict, b: dict) -> dict: """Update dict in place with |= operator.""...
(1, 2, 3)
assert
collection
src/new_py3/py3.py
test_keyword_only
TestPython30
248
null
crazyguitar/pysheeet
from abc import ABC, abstractmethod from functools import total_ordering import pytest class TestComparison: def test_total_ordering(self): assert Number(1) < Number(2) assert Number(2) >
Number(1)
assert
func_call
src/basic/object.py
test_total_ordering
TestComparison
294
null
crazyguitar/pysheeet
from __future__ import annotations import __future__ import sys import pytest def get_all_features() -> list[str]: """Get all available future features.""" return __future__.all_feature_names def get_feature_info(name: str) -> tuple: """Get feature info (optional, mandatory versions).""" feature = get...
1
assert
numeric_literal
src/basic/future_.py
test_node_creation
TestAnnotations
85
null
crazyguitar/pysheeet
import inspect from contextlib import contextmanager from types import GeneratorType import pytest def simple_gen(): """Simple generator yielding values.""" yield 1 yield 2 yield 3 def countdown(n: int): """Countdown generator.""" while n > 0: yield n n -= 1 def fibonacci(n: ...
5
assert
numeric_literal
src/basic/generator.py
test_evaluate_simple
TestCompiler
520
null
crazyguitar/pysheeet
import heapq import pytest def heapify_list(items: list) -> list: """Convert list to heap in-place.""" h = items.copy() heapq.heapify(h) return h def heap_push(h: list, item) -> list: """Push item onto heap.""" heapq.heappush(h, item) return h def heap_pop(h: list): """Pop smallest i...
"high"
assert
string_literal
src/basic/heap.py
test_task_queue
TestCustomObjects
220
null
crazyguitar/pysheeet
import pytest import time from threading import Thread, Lock, RLock, Semaphore, Event, Condition, Barrier from queue import Queue from concurrent.futures import ThreadPoolExecutor, as_completed def _mp_square(x): return x * x def _mp_add(a, b): return a + b def _mp_worker(q, n): q.put(n * n) def _mp_inc...
True
assert
bool_literal
src/basic/concurrency_.py
test_future_cancel
TestConcurrentFutures
382
null
crazyguitar/pysheeet
import pytest import time from threading import Thread, Lock, RLock, Semaphore, Event, Condition, Barrier from queue import Queue from concurrent.futures import ThreadPoolExecutor, as_completed def _mp_square(x): return x * x def _mp_add(a, b): return a + b def _mp_worker(q, n): q.put(n * n) def _mp_inc...
[3, 7, 11]
assert
collection
src/basic/concurrency_.py
test_pool_starmap
TestMultiprocessing
254
null
crazyguitar/pysheeet
import pytest from typing import ( Optional, Union, Callable, TypeVar, Generic, Protocol, TypedDict, Literal, Final, ClassVar, ) def greet(name: str) -> str: """Function with type annotations.""" return f"Hello, {name}!" def add(a: int, b: int) -> int: """Add two in...
2
assert
numeric_literal
src/basic/typing_.py
test_stack
TestGenericClass
204
null
crazyguitar/pysheeet
import csv import gzip import json import tempfile import zipfile from pathlib import Path def test_csv_dictreader(tmp_path): """Read CSV with DictReader.""" csv_path = tmp_path / "data.csv" csv_path.write_text("name,age\nAlice,30\nBob,25") with open(csv_path, newline="", encoding="utf-8") as f: ...
"30"
assert
string_literal
src/basic/fileio_.py
test_csv_dictreader
222
null
crazyguitar/pysheeet
import sys import platform import pytest def get_version_info() -> tuple: """Get Python version info.""" return sys.version_info[:3] def get_version_string() -> str: """Get Python version as string.""" return platform.python_version() def check_version(major: int, minor: int) -> bool: """Check if...
10
assert
numeric_literal
src/basic/basic.py
test_sum_range
TestLoops
161
null
crazyguitar/pysheeet
import asyncio import pytest class TestAsyncioBasics: def test_wait_for_timeout(self): """Test timeout handling.""" async def slow(): await asyncio.sleep(10) async def main(): await asyncio.wait_for(slow(), timeout=0.01) with pytest.raises(
asyncio.TimeoutError)
pytest.raises
complex_expr
src/basic/asyncio_.py
test_wait_for_timeout
TestAsyncioBasics
55
null
crazyguitar/pysheeet
import os import platform import subprocess import tempfile from pathlib import Path import pytest class TestPathlib: def test_glob(self): """Test glob pattern matching.""" with tempfile.TemporaryDirectory() as tmpdir: (Path(tmpdir) / "file1.py").touch() (Path(tmpdir) / "f...
2
assert
numeric_literal
src/basic/os_.py
test_glob
TestPathlib
294
null
crazyguitar/pysheeet
import pytest import unicodedata def encode_utf8(s: str) -> bytes: """Encode string to UTF-8 bytes.""" return s.encode("utf-8") def decode_utf8(b: bytes) -> str: """Decode UTF-8 bytes to string.""" return b.decode("utf-8") def encode_with_errors(s: str, encoding: str, errors: str) -> bytes: """En...
"CAFÉ"
assert
string_literal
src/basic/unicode_.py
test_unicode_upper_lower
TestStringOperations
149
null
crazyguitar/pysheeet
from __future__ import annotations import __future__ import sys import pytest def get_all_features() -> list[str]: """Get all available future features.""" return __future__.all_feature_names def get_feature_info(name: str) -> tuple: """Get feature info (optional, mandatory versions).""" feature = get...
None
assert
none_literal
src/basic/future_.py
test_get_feature_info
TestFutureFeatures
78
null
crazyguitar/pysheeet
import re from collections import namedtuple import pytest def search_pattern(pattern: str, text: str) -> str | None: """Find first match of pattern in text.""" m = re.search(pattern, text) return m.group() if m else None def match_start(pattern: str, text: str) -> bool: """Check if text starts with ...
"123"
assert
string_literal
src/basic/rexp.py
test_search
TestBasicMatching
227
null
crazyguitar/pysheeet
import pytest def create_set_literal(): """Create set using literal syntax.""" return {1, 2, 3} def create_set_from_list(items: list) -> set: """Create set from list, removing duplicates.""" return set(items) def create_empty_set() -> set: """Create empty set.""" return set() def set_compreh...
{4, 5}
assert
collection
src/basic/set.py
test_filter
TestSetComprehension
164
null
crazyguitar/pysheeet
import sys import platform import pytest def get_version_info() -> tuple: """Get Python version info.""" return sys.version_info[:3] def get_version_string() -> str: """Get Python version as string.""" return platform.python_version() def check_version(major: int, minor: int) -> bool: """Check if...
4
assert
numeric_literal
src/basic/basic.py
test_find_first_even
TestLoops
164
null
crazyguitar/pysheeet
import sys import threading from datetime import datetime import pytest class TestVector: def test_add(self): v1 = vector.Vector2D(1, 2) v2 = vector.Vector2D(3, 4) v3 = v1 + v2 assert v3.x == 4 assert v3.y ==
6
assert
numeric_literal
src/cext/test_cext.py
test_add
TestVector
105
null
crazyguitar/pysheeet
import csv import gzip import json import tempfile import zipfile from pathlib import Path def test_pathlib_properties(tmp_path): """Test pathlib path properties.""" p = tmp_path / "folder" / "report.pdf" assert p.name == "report.pdf" assert p.stem == "report" assert p.suffix ==
".pdf"
assert
string_literal
src/basic/fileio_.py
test_pathlib_properties
73
null
crazyguitar/pysheeet
import inspect from contextlib import contextmanager from types import GeneratorType import pytest def simple_gen(): """Simple generator yielding values.""" yield 1 yield 2 yield 3 def countdown(n: int): """Countdown generator.""" while n > 0: yield n n -= 1 def fibonacci(n: ...
["test"]
assert
collection
src/basic/generator.py
test_capture
TestContextManager
288
null
crazyguitar/pysheeet
import pytest def create_set_literal(): """Create set using literal syntax.""" return {1, 2, 3} def create_set_from_list(items: list) -> set: """Create set from list, removing duplicates.""" return set(items) def create_empty_set() -> set: """Create empty set.""" return set() def set_compreh...
{1, 3}
assert
collection
src/basic/set.py
test_remove
TestAddRemove
190
null
crazyguitar/pysheeet
import sys import threading from datetime import datetime import pytest class TestExample: def test_add(self): assert example.add(1, 2) ==
3
assert
numeric_literal
src/cext/test_cext.py
test_add
TestExample
53
null
crazyguitar/pysheeet
import pytest from collections import defaultdict, OrderedDict from functools import lru_cache def create_dict_literal(): """Create dict using literal syntax.""" return {"key": "value", "num": 42} def create_dict_constructor(): """Create dict using constructor.""" return dict(key="value", num=42) def...
[1, 2]
assert
collection
src/basic/dict.py
test_get_values
TestDictAccess
162
null
crazyguitar/pysheeet
import pytest from typing import ( Optional, Union, Callable, TypeVar, Generic, Protocol, TypedDict, Literal, Final, ClassVar, ) def greet(name: str) -> str: """Function with type annotations.""" return f"Hello, {name}!" def add(a: int, b: int) -> int: """Add two in...
5
assert
numeric_literal
src/basic/typing_.py
test_add
TestBasicTypes
159
null
crazyguitar/pysheeet
import pytest from collections import defaultdict, OrderedDict from functools import lru_cache def create_dict_literal(): """Create dict using literal syntax.""" return {"key": "value", "num": 42} def create_dict_constructor(): """Create dict using constructor.""" return dict(key="value", num=42) def...
[("a", 1)]
assert
collection
src/basic/dict.py
test_get_items
TestDictAccess
165
null
crazyguitar/pysheeet
import sys import asyncio import pytest from dataclasses import dataclass, FrozenInstanceError PY_VERSION = sys.version_info[:2] def dict_merge(a: dict, b: dict) -> dict: """Merge dicts with | operator.""" return a | b def dict_update(a: dict, b: dict) -> dict: """Update dict in place with |= operator.""...
5
assert
numeric_literal
src/new_py3/py3.py
test_walrus
TestPython38
206
null
crazyguitar/pysheeet
import pytest from sqlalchemy import ( create_engine, Column, Integer, String, ForeignKey, Table, select, and_, or_, func, DateTime, event, ) from sqlalchemy.orm import ( declarative_base, sessionmaker, relationship, joinedload, ) from sqlalchemy.ext.hybri...
1
assert
numeric_literal
src/basic/sqlalchemy_orm.py
test_add_commit
TestSession
68
null
crazyguitar/pysheeet
import socket import threading import time import pytest class TestSocketOptions: def test_blocking(self): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.setblocking(False) assert sock.getblocking() is False sock.setblocking(True) assert sock.getblocking() i...
True
assert
bool_literal
src/basic/socket_.py
test_blocking
TestSocketOptions
104
null
crazyguitar/pysheeet
from __future__ import annotations import __future__ import sys import pytest def get_all_features() -> list[str]: """Get all available future features.""" return __future__.all_feature_names def get_feature_info(name: str) -> tuple: """Get feature info (optional, mandatory versions).""" feature = get...
2
assert
numeric_literal
src/basic/future_.py
test_get_feature_info
TestFutureFeatures
79
null
crazyguitar/pysheeet
import pytest import time from threading import Thread, Lock, RLock, Semaphore, Event, Condition, Barrier from queue import Queue from concurrent.futures import ThreadPoolExecutor, as_completed def _mp_square(x): return x * x def _mp_add(a, b): return a + b def _mp_worker(q, n): q.put(n * n) def _mp_inc...
[0, 1, 2]
assert
collection
src/basic/concurrency_.py
test_event
TestThreading
146
null
crazyguitar/pysheeet
import heapq import pytest def heapify_list(items: list) -> list: """Convert list to heap in-place.""" h = items.copy() heapq.heapify(h) return h def heap_push(h: list, item) -> list: """Push item onto heap.""" heapq.heappush(h, item) return h def heap_pop(h: list): """Pop smallest i...
2
assert
numeric_literal
src/basic/heap.py
test_push_pop
TestBasicHeap
181
null
crazyguitar/pysheeet
import heapq import pytest def heapify_list(items: list) -> list: """Convert list to heap in-place.""" h = items.copy() heapq.heapify(h) return h def heap_push(h: list, item) -> list: """Push item onto heap.""" heapq.heappush(h, item) return h def heap_pop(h: list): """Pop smallest i...
[1, 3, 5]
assert
collection
src/basic/heap.py
test_k_smallest
TestKElements
227
null
crazyguitar/pysheeet
import pytest import time from threading import Thread, Lock, RLock, Semaphore, Event, Condition, Barrier from queue import Queue from concurrent.futures import ThreadPoolExecutor, as_completed def _mp_square(x): return x * x def _mp_add(a, b): return a + b def _mp_worker(q, n): q.put(n * n) def _mp_inc...
list(range(10))
assert
func_call
src/basic/concurrency_.py
test_multiple_consumers
TestProducerConsumer
457
null
crazyguitar/pysheeet
import heapq import pytest def heapify_list(items: list) -> list: """Convert list to heap in-place.""" h = items.copy() heapq.heapify(h) return h def heap_push(h: list, item) -> list: """Push item onto heap.""" heapq.heappush(h, item) return h def heap_pop(h: list): """Pop smallest i...
[9, 8, 5]
assert
collection
src/basic/heap.py
test_k_largest
TestKElements
230
null
crazyguitar/pysheeet
import pytest import sys import os build_dir = os.path.join(os.path.dirname(__file__), "build") class TestArgs: def test_kw_args(self): import args assert args.kw_args(1, 2) == (1, 2, None) assert args.kw_args(1, 2, 3) ==
(1, 2, 3)
assert
collection
src/cext/capi/test_capi.py
test_kw_args
TestArgs
62
null
crazyguitar/pysheeet
import pytest from sqlalchemy import ( create_engine, Column, Integer, String, ForeignKey, select, insert, func, desc, case, distinct, union_all, exists, text, ) from sqlalchemy.orm import ( declarative_base, sessionmaker, relationship, aliased, ) ...
2
assert
numeric_literal
src/basic/sqlalchemy_query.py
test_outer_join
TestJoin
262
null
crazyguitar/pysheeet
import pytest import unicodedata def encode_utf8(s: str) -> bytes: """Encode string to UTF-8 bytes.""" return s.encode("utf-8") def decode_utf8(b: bytes) -> str: """Decode UTF-8 bytes to string.""" return b.decode("utf-8") def encode_with_errors(s: str, encoding: str, errors: str) -> bytes: """En...
"中"
assert
string_literal
src/basic/unicode_.py
test_get_char
TestCodePoints
103
null
crazyguitar/pysheeet
import pytest import unicodedata def encode_utf8(s: str) -> bytes: """Encode string to UTF-8 bytes.""" return s.encode("utf-8") def decode_utf8(b: bytes) -> str: """Decode UTF-8 bytes to string.""" return b.decode("utf-8") def encode_with_errors(s: str, encoding: str, errors: str) -> bytes: """En...
"café"
assert
string_literal
src/basic/unicode_.py
test_unicode_upper_lower
TestStringOperations
150
null
crazyguitar/pysheeet
from functools import lru_cache, partial, reduce, singledispatch, wraps import pytest def greet(name: str, greeting: str = "Hello") -> str: """Greet with optional greeting.""" return f"{greeting}, {name}!" def good_default(items=None): """Correct way to use mutable default.""" if items is None: ...
1
assert
numeric_literal
src/basic/func.py
test_mixed
TestVariableArguments
221
null
crazyguitar/pysheeet
import bisect import copy import itertools from collections import defaultdict, deque from functools import reduce import pytest def init_immutable(n: int) -> list: """Initialize list with immutable objects.""" return [0] * n def init_mutable(n: int) -> list: """Initialize list with mutable objects (corr...
5
assert
numeric_literal
src/basic/list.py
test_extended
TestUnpacking
153
null
crazyguitar/pysheeet
import pytest import hmac import secrets import os class TestSQLInjection: def test_vulnerable_query_building(self): """INSECURE: String formatting in SQL.""" def build_query_insecure(username): # VULNERABLE: User input directly in query return f"SELECT * FROM users WHERE ...
query
assert
variable
src/security/vulnerability_.py
test_vulnerable_query_building
TestSQLInjection
84
null