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 |
|---|---|---|---|---|---|---|---|---|---|
crazyguitar/pysheeet | from abc import ABC, abstractmethod
from functools import total_ordering
import pytest
class TestClassAttributes:
def test_counter(self):
Counter.count = 0
a, b = Counter(), Counter()
assert a.id == | 1 | assert | numeric_literal | src/basic/object.py | test_counter | TestClassAttributes | 261 | 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, 2) | assert | collection | src/basic/list.py | test_unzip | TestEnumerateZip | 165 | 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", "b"] | assert | collection | src/basic/dict.py | test_get_keys | TestDictAccess | 159 | 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_decode_utf8 | TestEncodingDecoding | 81 | null |
crazyguitar/pysheeet | import csv
import gzip
import json
import tempfile
import zipfile
from pathlib import Path
def test_file_stat(tmp_path):
"""Get file statistics."""
p = tmp_path / "file.txt"
p.write_text("some content")
stat = p.stat()
assert stat.st_size == len("some content")
assert stat.st_mtime > | 0 | assert | numeric_literal | src/basic/fileio_.py | test_file_stat | 300 | 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... | "A" | assert | string_literal | src/basic/unicode_.py | test_get_char | TestCodePoints | 101 | null |
crazyguitar/pysheeet | import asyncio
import pytest
class TestExceptionHandling:
def test_gather_return_exceptions(self):
"""Test gather with return_exceptions."""
async def ok():
return "ok"
async def fail():
raise ValueError("error")
async def main():
return await... | "ok" | assert | string_literal | src/basic/asyncio_.py | test_gather_return_exceptions | TestExceptionHandling | 312 | null |
crazyguitar/pysheeet | import calendar
import time
from datetime import date, datetime, time as dt_time, timedelta, timezone
def test_create_datetime():
"""Create datetime objects."""
dt = datetime(2024, 1, 15, 10, 30, 45)
assert dt.year == 2024
assert dt.month == 1
assert dt.day == 15
assert dt.hour == 10
d = d... | dt | assert | variable | src/basic/datetime_.py | test_create_datetime | 31 | 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... | "task1" | assert | string_literal | src/basic/heap.py | test_update_priority | TestIndexedHeap | 268 | 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:
... | 3 | assert | numeric_literal | src/basic/func.py | test_counter | TestClosure | 269 | null |
crazyguitar/pysheeet | from abc import ABC, abstractmethod
from functools import total_ordering
import pytest
class TestClassAttributes:
def test_counter(self):
Counter.count = 0
a, b = Counter(), Counter()
assert a.id == 1
assert b.id == | 2 | assert | numeric_literal | src/basic/object.py | test_counter | TestClassAttributes | 262 | 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... | 2 | assert | numeric_literal | src/basic/sqlalchemy_orm.py | test_select_all | TestORMQuery | 112 | 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... | 42 | assert | numeric_literal | src/basic/basic.py | test_parse_int | TestExceptions | 181 | null |
crazyguitar/pysheeet | import csv
import gzip
import json
import tempfile
import zipfile
from pathlib import Path
def test_binary_files(tmp_path):
"""Read and write binary files."""
p = tmp_path / "binary.bin"
data = b"\x00\x01\x02\xff"
with open(p, "wb") as f:
f.write(data)
with open(p, "rb") as f:
res... | data | assert | variable | src/basic/fileio_.py | test_binary_files | 64 | 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, 2, 3} | assert | collection | src/basic/set.py | test_literal | TestSetCreation | 149 | 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... | "Alice" | assert | string_literal | src/basic/sqlalchemy_orm.py | test_filter_where | TestORMQuery | 139 | 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: ... | 6 | assert | numeric_literal | src/basic/generator.py | test_evaluate_simple | TestCompiler | 521 | 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,
)
... | "A" | assert | string_literal | src/basic/sqlalchemy_query.py | test_having | TestGroupBy | 190 | 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, 2, 3] | assert | collection | src/basic/generator.py | test_simple_gen | TestGeneratorBasics | 168 | 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... | "a" | assert | string_literal | src/basic/typing_.py | test_first | TestGenerics | 192 | 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 | 102 | null |
crazyguitar/pysheeet | import calendar
import time
from datetime import date, datetime, time as dt_time, timedelta, timezone
def test_create_datetime():
"""Create datetime objects."""
dt = datetime(2024, 1, 15, 10, 30, 45)
assert dt.year == 2024
assert dt.month == | 1 | assert | numeric_literal | src/basic/datetime_.py | test_create_datetime | 24 | 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... | b"Caf" | assert | string_literal | src/basic/unicode_.py | test_encode_errors_ignore | TestEncodingDecoding | 88 | 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 ... | "Hello" | assert | string_literal | src/basic/rexp.py | test_strip_tags | TestHtmlTags | 343 | null |
crazyguitar/pysheeet | import socket
import threading
import time
import pytest
class TestByteOrder:
def test_htons(self):
# Host to network short
result = socket.htons(1)
# On little-endian, 1 becomes 256
assert result in | (1, 256) | assert | collection | src/basic/socket_.py | test_htons | TestByteOrder | 37 | null |
crazyguitar/pysheeet | import os
import platform
import subprocess
import tempfile
from pathlib import Path
import pytest
class TestSystemInfo:
def test_cpu_count(self):
"""Test cpu_count returns positive integer."""
count = os.cpu_count()
assert count is not | None | assert | none_literal | src/basic/os_.py | test_cpu_count | TestSystemInfo | 31 | null |
crazyguitar/pysheeet | import os
import platform
import subprocess
import tempfile
from pathlib import Path
import pytest
class TestFileOperations:
def test_getsize(self):
"""Test getting file size."""
with tempfile.NamedTemporaryFile(mode="w", delete=False) as f:
f.write("hello")
path = f.name
... | 5 | assert | numeric_literal | src/basic/os_.py | test_getsize | TestFileOperations | 190 | null |
crazyguitar/pysheeet | import calendar
import time
from datetime import date, datetime, time as dt_time, timedelta, timezone
def test_weekday_operations():
"""Work with weekdays and weeks."""
dt = datetime(2024, 1, 15) # Monday
assert dt.weekday() == | 0 | assert | numeric_literal | src/basic/datetime_.py | test_weekday_operations | 122 | null | |
crazyguitar/pysheeet | import pytest
import hmac
import secrets
import os
class TestTimingAttack:
def test_insecure_comparison(self):
"""Insecure comparison - vulnerable to timing attack."""
secret = b"correct_secret_token"
def insecure_compare(a, b):
"""INSECURE: Returns early on mismatch."""
... | True | assert | bool_literal | src/security/vulnerability_.py | test_insecure_comparison | TestTimingAttack | 26 | null |
crazyguitar/pysheeet | import pytest
import sys
import os
build_dir = os.path.join(os.path.dirname(__file__), "build")
class TestTypesDemo:
def test_set_contains(self):
import types_demo
s = {1, 2, 3}
assert types_demo.set_contains(s, 2) is | True | assert | bool_literal | src/cext/capi/test_capi.py | test_set_contains | TestTypesDemo | 168 | null |
crazyguitar/pysheeet | import multiprocessing
import platform
import unittest
import requests
import os
from pathlib import Path
from werkzeug.exceptions import NotFound
from flask_testing import LiveServerTestCase
from app import acme, find_key, static_proxy, index_redirection, page_not_found
from app import ROOT
from app import app
cla... | key) | self.assertEqual | variable | app_test.py | test_find_key | PysheeetTest | 97 | null |
crazyguitar/pysheeet | import ctypes
import math
import os
import platform
import subprocess
import tempfile
import pytest
def has_c_compiler():
"""Check if gcc or clang is available."""
for compiler in ["gcc", "clang", "cc"]:
try:
result = subprocess.run(
[compiler, "--version"], capture_output=... | 1 | assert | numeric_literal | src/basic/cext_.py | test_fib | TestCtypesCustomLibrary | 213 | 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... | 0 | assert | numeric_literal | src/basic/list.py | test_binary_search | TestBisect | 288 | null |
crazyguitar/pysheeet | import os
import platform
import subprocess
import tempfile
from pathlib import Path
import pytest
class TestPathOperations:
def test_join(self):
"""Test os.path.join."""
path = os.path.join("dir1", "dir2", "file.txt")
assert "dir1" in | path | assert | variable | src/basic/os_.py | test_join | TestPathOperations | 77 | 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 l... | 1 | assert | numeric_literal | src/basic/fileio_.py | test_list_directory | 118 | 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, 4} | assert | collection | src/basic/set.py | test_symmetric_difference | TestSetOperations | 220 | 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... | ("a", "b") | assert | collection | src/basic/list.py | test_unzip | TestEnumerateZip | 166 | null |
crazyguitar/pysheeet | from abc import ABC, abstractmethod
from functools import total_ordering
import pytest
class TestBasicClass:
def test_person(self):
p = Person("Alice", 30)
assert p.name == | "Alice" | assert | string_literal | src/basic/object.py | test_person | TestBasicClass | 253 | 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 | assert | numeric_literal | src/basic/dict.py | test_getitem | TestEmuDict | 196 | 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... | 0 | assert | numeric_literal | src/basic/set.py | test_empty | TestSetCreation | 156 | 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... | 2 | assert | numeric_literal | src/basic/list.py | test_push_pop | TestStack | 183 | null |
crazyguitar/pysheeet | import pytest
import hmac
import secrets
import os
class TestAESModes:
def test_ecb_mode_pattern_leak(self):
"""INSECURE: ECB mode leaks patterns in plaintext."""
# ECB encrypts identical blocks to identical ciphertext
# This reveals patterns in the data
# Simulated ECB behavior (... | encrypted[2] | assert | complex_expr | src/security/vulnerability_.py | test_ecb_mode_pattern_leak | TestAESModes | 210 | null |
crazyguitar/pysheeet | from datetime import datetime
import pytest
from sqlalchemy import (
create_engine,
MetaData,
Table,
Column,
Integer,
String,
ForeignKey,
select,
insert,
update,
delete,
text,
inspect,
func,
and_,
or_,
desc,
case,
distinct,
union_all,
e... | "Alice" | assert | string_literal | src/basic/sqlalchemy_core.py | test_execute_raw_sql | TestRawSQL | 74 | null |
crazyguitar/pysheeet | import csv
import gzip
import json
import tempfile
import zipfile
from pathlib import Path
def test_pathlib_with_suffix():
"""Change path suffix."""
p = Path("/home/user/doc.txt")
new_p = p.with_suffix(".md")
assert new_p.suffix == ".md"
assert new_p.stem == | "doc" | assert | string_literal | src/basic/fileio_.py | test_pathlib_with_suffix | 82 | 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... | 2 | assert | numeric_literal | src/basic/dict.py | test_len | TestEmuDict | 209 | null |
crazyguitar/pysheeet | import pytest
import sys
import os
build_dir = os.path.join(os.path.dirname(__file__), "build")
class TestArgs:
def test_pos_args(self):
import args
assert args.pos_args(1, 2) == | (1, 2) | assert | collection | src/cext/capi/test_capi.py | test_pos_args | TestArgs | 55 | null |
crazyguitar/pysheeet | import asyncio
import pytest
class TestAsyncioBasics:
def test_wait_first_completed(self):
"""Test waiting for first completed task."""
async def fast():
await asyncio.sleep(0.01)
return "fast"
async def slow():
await asyncio.sleep(1)
retur... | 1 | assert | numeric_literal | src/basic/asyncio_.py | test_wait_first_completed | TestAsyncioBasics | 79 | 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:
... | 2 | assert | numeric_literal | src/basic/func.py | test_mixed | TestVariableArguments | 222 | null |
crazyguitar/pysheeet | import asyncio
import pytest
class TestAsyncIterator:
def test_async_iterator(self):
"""Test custom async iterator."""
class AsyncRange:
def __init__(self, stop):
self.current = 0
self.stop = stop
def __aiter__(self):
return... | [0, 1, 2] | assert | collection | src/basic/asyncio_.py | test_async_iterator | TestAsyncIterator | 112 | null |
crazyguitar/pysheeet | import os
import platform
import subprocess
import tempfile
from pathlib import Path
import pytest
class TestPathOperations:
def test_splitext(self):
"""Test splitext."""
name, ext = os.path.splitext("file.txt")
assert name == | "file" | assert | string_literal | src/basic/os_.py | test_splitext | TestPathOperations | 90 | 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... | 1 | assert | numeric_literal | src/basic/unicode_.py | test_nfc | TestNormalization | 114 | 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 ... | ["user"] | assert | collection | src/basic/rexp.py | test_lookahead | TestLookaround | 281 | 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... | 4 | assert | numeric_literal | src/basic/list.py | test_bisect_right | TestBisect | 284 | 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... | 5 | assert | numeric_literal | src/basic/heap.py | test_max_heap_item | TestCustomObjects | 216 | null |
crazyguitar/pysheeet | import pytest
import sys
import os
build_dir = os.path.join(os.path.dirname(__file__), "build")
class TestSimple:
def test_add(self):
import simple
assert simple.add(1, 2) == | 3 | assert | numeric_literal | src/cext/capi/test_capi.py | test_add | TestSimple | 26 | null |
crazyguitar/pysheeet | import ctypes
import math
import os
import platform
import subprocess
import tempfile
import pytest
def has_c_compiler():
"""Check if gcc or clang is available."""
for compiler in ["gcc", "clang", "cc"]:
try:
result = subprocess.run(
[compiler, "--version"], capture_output=... | 0 | assert | numeric_literal | src/basic/cext_.py | test_nested_structure | TestCtypesStructures | 111 | 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... | {"b"} | assert | collection | src/basic/dict.py | test_find_common_keys | TestDictOperations | 170 | null |
crazyguitar/pysheeet | import asyncio
import pytest
class TestSynchronization:
def test_semaphore(self):
"""Test asyncio.Semaphore for rate limiting."""
async def main():
semaphore = asyncio.Semaphore(2)
concurrent = [0]
max_concurrent = [0]
async def task():
... | 2 | assert | numeric_literal | src/basic/asyncio_.py | test_semaphore | TestSynchronization | 213 | 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... | [2, 4, 6] | assert | collection | src/basic/list.py | test_filter_even | TestComprehensions | 142 | 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,
)
... | "B" | assert | string_literal | src/basic/sqlalchemy_query.py | test_case | TestCase | 475 | 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... | None | assert | none_literal | src/basic/crypto_.py | test_key_generation | TestRSA | 223 | 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 l... | 2 | assert | numeric_literal | src/basic/fileio_.py | test_list_directory | 117 | 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... | d | assert | variable | src/basic/dict.py | test_contains | TestEmuDict | 205 | 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,
)
... | 4 | assert | numeric_literal | src/basic/sqlalchemy_query.py | test_union_all | TestUnion | 438 | 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... | None | assert | none_literal | src/basic/basic.py | test_find_first_even | TestLoops | 165 | 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... | node2 | assert | variable | src/basic/future_.py | test_node_append | TestAnnotations | 91 | 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... | 3 | assert | numeric_literal | src/basic/basic.py | test_get_version_info | TestVersion | 140 | null |
crazyguitar/pysheeet | import csv
import gzip
import json
import tempfile
import zipfile
from pathlib import Path
def test_pathlib_with_suffix():
"""Change path suffix."""
p = Path("/home/user/doc.txt")
new_p = p.with_suffix(".md")
assert new_p.suffix == | ".md" | assert | string_literal | src/basic/fileio_.py | test_pathlib_with_suffix | 81 | 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... | set() | assert | func_call | src/basic/set.py | test_empty | TestSetCreation | 155 | 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.""... | Point(1, 2) | assert | func_call | src/new_py3/py3.py | test_dataclass | TestPython37 | 215 | 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, 2, 3] | assert | collection | src/basic/list.py | test_shallow | TestCopy | 128 | 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... | "zero" | assert | string_literal | src/basic/basic.py | test_classify_number | TestControlFlow | 151 | null |
crazyguitar/pysheeet | import socket
import threading
import time
import pytest
class TestHostname:
def test_gethostname(self):
hostname = socket.gethostname()
assert isinstance(hostname, str)
assert len(hostname) > | 0 | assert | numeric_literal | src/basic/socket_.py | test_gethostname | TestHostname | 15 | 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: ... | 0 | assert | numeric_literal | src/basic/generator.py | test_accumulator | TestSend | 200 | null |
crazyguitar/pysheeet | import asyncio
import pytest
class TestAsyncioBasics:
def test_asyncio_run(self):
"""Test basic coroutine execution."""
async def hello():
return "hello"
result = asyncio.run(hello())
assert result == | "hello" | assert | string_literal | src/basic/asyncio_.py | test_asyncio_run | TestAsyncioBasics | 17 | null |
crazyguitar/pysheeet | import sys
import threading
from datetime import datetime
import pytest
class TestExample:
def test_fib(self):
assert example.fib(0) == 0
assert example.fib(1) == | 1 | assert | numeric_literal | src/cext/test_cext.py | test_fib | TestExample | 59 | null |
tmux-python/tmuxp | from __future__ import annotations
import pathlib
from tests.cli.conftest import (
ANSI_BLUE,
ANSI_CYAN,
ANSI_GREEN,
ANSI_RED,
ANSI_RESET,
ANSI_YELLOW,
)
from tmuxp._internal.private_path import PrivatePath
from tmuxp.cli._colors import Colors
def test_freeze_combined_output_format(colors_alw... | output | assert | variable | tests/cli/test_freeze_colors.py | test_freeze_combined_output_format | 75 | null | |
tmux-python/tmuxp | from __future__ import annotations
import pathlib
import pytest
from tests.cli.conftest import ANSI_BLUE, ANSI_BOLD, ANSI_CYAN, ANSI_MAGENTA
from tmuxp._internal.private_path import PrivatePath, collapse_home_in_string
from tmuxp.cli._colors import ColorMode, Colors
def test_debug_info_format_kv_labels(colors_alway... | result | assert | variable | tests/cli/test_debug_info_colors.py | test_debug_info_format_kv_labels | 49 | null | |
tmux-python/tmuxp | from __future__ import annotations
import pathlib
from tests.cli.conftest import ANSI_BOLD, ANSI_CYAN, ANSI_GREEN, ANSI_MAGENTA
from tmuxp._internal.private_path import PrivatePath
from tmuxp.cli._colors import Colors
def test_convert_prompt_format_with_highlight(colors_always: Colors) -> None:
"""Verify prompt ... | prompt | assert | variable | tests/cli/test_convert_colors.py | test_convert_prompt_format_with_highlight | 69 | null | |
tmux-python/tmuxp | from __future__ import annotations
import typing as t
import pytest
from tests.fixtures import import_tmuxinator as fixtures
from tmuxp._internal.config_reader import ConfigReader
from tmuxp.workspace import importers, validation
@pytest.mark.parametrize(
list(TmuxinatorConfigTestFixture._fields),
TMUXINATO... | tmuxp_dict | assert | variable | tests/workspace/test_import_tmuxinator.py | test_config_to_dict | 60 | null | |
tmux-python/tmuxp | from __future__ import annotations
import argparse
import subprocess
import pytest
from tmuxp.cli import create_parser
def _get_help_text(subcommand: str | None = None) -> str:
"""Get CLI help text without spawning subprocess.
Parameters
----------
subcommand : str | None
Subcommand name, o... | help_text | assert | variable | tests/cli/test_help_examples.py | test_main_help_examples_are_colorized | 273 | null | |
tmux-python/tmuxp | from __future__ import annotations
import contextlib
import io
import subprocess
import typing as t
import pytest
from tmuxp import cli, exc
@pytest.mark.parametrize(
list(CLIShellFixture._fields),
TEST_SHELL_FIXTURES,
ids=[test.test_id for test in TEST_SHELL_FIXTURES],
)
def test_shell(
test_id: st... | result.out | assert | complex_expr | tests/cli/test_shell.py | test_shell | 237 | null | |
tmux-python/tmuxp | from __future__ import annotations
import argparse
import typing as t
from docutils import nodes
from sphinx_argparse_neo.nodes import (
argparse_argument,
argparse_group,
argparse_program,
argparse_subcommand,
argparse_subcommands,
argparse_usage,
)
from sphinx_argparse_neo.parser import (
... | 2 | assert | numeric_literal | tests/docs/_ext/sphinx_argparse_neo/test_renderer.py | test_render_with_subcommands | 208 | null | |
tmux-python/tmuxp | from __future__ import annotations
import pathlib
from tests.cli.conftest import ANSI_BOLD, ANSI_CYAN, ANSI_GREEN, ANSI_MAGENTA
from tmuxp._internal.private_path import PrivatePath
from tmuxp.cli._colors import Colors
def test_convert_success_message(colors_always: Colors) -> None:
"""Verify success messages use... | result | assert | variable | tests/cli/test_convert_colors.py | test_convert_success_message | 17 | null | |
tmux-python/tmuxp | from __future__ import annotations
import pathlib
import pytest
from tests.cli.conftest import ANSI_BLUE, ANSI_CYAN, ANSI_RESET
from tmuxp.cli._colors import ColorMode, Colors
def test_prompt_bool_choice_indicator_muted(colors_always: Colors) -> None:
"""Verify [Y/n] uses muted color (blue)."""
# Test the m... | result | assert | variable | tests/cli/test_prompt_colors.py | test_prompt_bool_choice_indicator_muted | 17 | null | |
tmux-python/tmuxp | from __future__ import annotations
import pathlib
import pytest
from tests.cli.conftest import ANSI_BLUE, ANSI_CYAN, ANSI_RESET
from tmuxp.cli._colors import ColorMode, Colors
def test_prompts_respect_no_color_env(monkeypatch: pytest.MonkeyPatch) -> None:
"""Verify NO_COLOR disables prompt colors."""
monkey... | "[default]" | assert | string_literal | tests/cli/test_prompt_colors.py | test_prompts_respect_no_color_env | 53 | null | |
tmux-python/tmuxp | from __future__ import annotations
import contextlib
import io
import pathlib
import typing as t
import libtmux
import pytest
from libtmux.server import Server
from libtmux.session import Session
from tests.constants import FIXTURE_PATH
from tests.fixtures import utils as test_utils
from tmuxp import cli
from tmuxp.... | output | assert | variable | tests/cli/test_load.py | test_load | 335 | null | |
tmux-python/tmuxp | from __future__ import annotations
import pathlib
import pytest
from tmuxp._internal.private_path import PrivatePath, collapse_home_in_string
def test_private_path_collapses_home_exact(monkeypatch: pytest.MonkeyPatch) -> None:
"""PrivatePath handles exact home directory match."""
monkeypatch.setattr(pathlib... | "~" | assert | string_literal | tests/_internal/test_private_path.py | test_private_path_collapses_home_exact | 27 | null | |
tmux-python/tmuxp | from __future__ import annotations
import pytest
from tests._internal.conftest import ANSI_BLUE, ANSI_BOLD, ANSI_CYAN, ANSI_MAGENTA
from tmuxp._internal.colors import ColorMode, Colors
def test_format_version_plain_text() -> None:
"""format_version returns plain text when colors disabled."""
colors = Colors(... | "3.2a" | assert | string_literal | tests/_internal/test_colors_formatters.py | test_format_version_plain_text | 55 | null | |
tmux-python/tmuxp | from __future__ import annotations
import typing as t
import pytest
from argparse_exemplar import ( # type: ignore[import-not-found]
ExemplarConfig,
_extract_sections_from_container,
_is_examples_section,
_is_usage_block,
_reorder_nodes,
is_base_examples_term,
is_examples_term,
make_s... | 3 | assert | numeric_literal | tests/docs/_ext/test_argparse_exemplar.py | test_transform_definition_list_code_blocks_created | 459 | null | |
tmux-python/tmuxp | from __future__ import annotations
import pathlib
from tests.cli.conftest import (
ANSI_BLUE,
ANSI_CYAN,
ANSI_GREEN,
ANSI_RED,
ANSI_RESET,
ANSI_YELLOW,
)
from tmuxp._internal.private_path import PrivatePath
from tmuxp.cli._colors import Colors
def test_freeze_error_uses_red(colors_always: Col... | result | assert | variable | tests/cli/test_freeze_colors.py | test_freeze_error_uses_red | 25 | null | |
tmux-python/tmuxp | from __future__ import annotations
import typing as t
import pytest
from sphinx_argparse_neo.utils import escape_rst_emphasis, strip_ansi
@pytest.mark.parametrize(
StripAnsiFixture._fields,
STRIP_ANSI_FIXTURES,
ids=[f.test_id for f in STRIP_ANSI_FIXTURES],
)
def test_strip_ansi(test_id: str, input_text: ... | expected | assert | variable | tests/docs/_ext/sphinx_argparse_neo/test_utils.py | test_strip_ansi | 72 | null | |
tmux-python/tmuxp | from __future__ import annotations
import sys
import typing as t
import pytest
from tmuxp import exc
from tmuxp.exc import BeforeLoadScriptError, BeforeLoadScriptNotExists
from tmuxp.util import get_session, run_before_script
from .constants import FIXTURE_PATH
def temp_script(tmp_path: pathlib.Path) -> pathlib.Pa... | 0 | assert | numeric_literal | tests/test_util.py | test_run_before_script_isatty | 98 | null | |
tmux-python/tmuxp | from __future__ import annotations
import contextlib
import io
import json
import typing as t
import pytest
from tmuxp import cli
@pytest.mark.parametrize(
list(ConvertTestFixture._fields),
CONVERT_TEST_FIXTURES,
ids=[test.test_id for test in CONVERT_TEST_FIXTURES],
)
def test_convert(
test_id: str,... | {"yaml", "yml"} | assert | collection | tests/cli/test_convert.py | test_convert | 66 | null | |
tmux-python/tmuxp | from __future__ import annotations
import argparse
import contextlib
import pathlib
import typing as t
import libtmux
import pytest
from tests.fixtures import utils as test_utils
from tmuxp import cli
from tmuxp._internal.config_reader import ConfigReader
from tmuxp.cli.import_config import get_teamocil_dir, get_tmu... | pathlib.Path("/moo/.teamocil/") | assert | func_call | tests/cli/test_cli.py | test_get_teamocil_dir | 110 | null | |
tmux-python/tmuxp | from __future__ import annotations
import sys
import typing as t
import pytest
from tests._internal.conftest import ANSI_BOLD, ANSI_MAGENTA, ANSI_RESET
from tmuxp._internal.colors import ColorMode, Colors, get_color_mode
def test_highlight_bold_parameter(monkeypatch: pytest.MonkeyPatch) -> None:
"""Verify highl... | with_bold | assert | variable | tests/_internal/test_colors_integration.py | test_highlight_bold_parameter | 157 | null | |
tmux-python/tmuxp | from __future__ import annotations
import json
import pathlib
import re
import typing as t
import pytest
from tmuxp.cli._colors import ColorMode, Colors
from tmuxp.cli._output import OutputFormatter, OutputMode
from tmuxp.cli.search import (
DEFAULT_FIELDS,
InvalidFieldError,
SearchPattern,
SearchTok... | [] | assert | collection | tests/cli/test_search.py | test_extract_workspace_fields_invalid_yaml | 419 | null | |
tmux-python/tmuxp | from __future__ import annotations
import argparse
import subprocess
import pytest
from tmuxp.cli import create_parser
def _get_help_text(subcommand: str | None = None) -> str:
"""Get CLI help text without spawning subprocess.
Parameters
----------
subcommand : str | None
Subcommand name, o... | help_text.lower() | assert | func_call | tests/cli/test_help_examples.py | test_main_help_example_sections_have_examples_suffix | 261 | null | |
tmux-python/tmuxp | from __future__ import annotations
import time
import typing
from tests.fixtures import utils as test_utils
from tmuxp._internal.config_reader import ConfigReader
from tmuxp.workspace import freezer, validation
from tmuxp.workspace.builder import WorkspaceBuilder
def test_freeze_config(session: Session) -> None:
... | builder.session | assert | complex_expr | tests/workspace/test_freezer.py | test_freeze_config | 29 | null | |
tmux-python/tmuxp | from __future__ import annotations
import argparse
import contextlib
import pathlib
import typing as t
import libtmux
import pytest
from tests.fixtures import utils as test_utils
from tmuxp import cli
from tmuxp._internal.config_reader import ConfigReader
from tmuxp.cli.import_config import get_teamocil_dir, get_tmu... | pathlib.Path("~/.tmuxinator/").expanduser() | assert | func_call | tests/cli/test_cli.py | test_get_tmuxinator_dir | 100 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.