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 |
|---|---|---|---|---|---|---|---|---|---|
py2many/py2many | import textwrap
def parse(*args):
return "\n".join(args)
def test_tuple_swap():
source = parse("x = 3", "y = 1", "x, y = y, x")
cpp = transpile(source)
assert cpp == | parse( "auto x = 3;", "auto y = 1;", "std::tie(x, y) = std::make_tuple(y, x);" ) | assert | func_call | tests/test_transpiler_cpp.py | test_tuple_swap | 98 | null | |
py2many/py2many | import ast
from py2many.context import add_list_calls, add_variable_context
from py2many.scope import add_scope_context
from py2many.tracer import is_recursive
def parse(*args):
source = ast.parse("\n".join(args))
add_variable_context(source, (source,))
add_scope_context(source)
return source
class T... | "foo(3 * 1) + 2" | assert | string_literal | tests/test_tracer_cpp.py | test_catch_expression_chain_with_functions | TestValueExpr | 84 | null |
py2many/py2many | import argparse
import logging
import os.path
import platform
import sys
from functools import lru_cache
from itertools import product
from pathlib import Path
from subprocess import run
from unittest.mock import Mock
import pytest
from py2many.cli import (
_create_cmd,
_get_all_settings,
_get_output_path... | generated | assert | variable | tests/test_cli.py | test_rust_ext | TestCodeGenerator | 463 | null |
py2many/py2many | from adt import adt as sealed
from py2many.smt import check_sat, default_value, get_model
from py2many.smt import pre as smt_pre
def classify_triangle_correct(a: int, b: int, c: int) -> TriangleType:
"""Classify triangle based on side lengths"""
# Classify the triangle
if a == b and b == c:
retur... | 0 | assert | numeric_literal | tests/cases/triangle_buggy.py | classify_triangle | 67 | null | |
py2many/py2many | from typing import Callable, Dict, List, Set, Optional
from ctypes import c_int8 as i8, c_int16 as i16, c_int32 as i32, c_int64 as i64
from ctypes import c_uint8 as u8, c_uint16 as u16, c_uint32 as u32, c_uint64 as u64
import sys
def default_builtins():
a: str = str()
b: bool = bool()
c: int = int()
d:... | False | assert | bool_literal | tests/expected/built_ins.py | default_builtins | 13 | null | |
py2many/py2many | def complex_test():
c1 = 2 + 3j
c2 = 4 + 5j
c3 = c1 + c2
assert c3 == 6 + 8j
c4 = c1 + 3
assert c4 == 5 + 3j
c5 = c1 + 4j
assert c5 == 2 + 7j
c6 = c3 - 2.3
assert c6 == | 3.7 + 8j | assert | complex_expr | tests/cases/complex.py | complex_test | 14 | null | |
py2many/py2many | def complex_test():
c1 = 2 + 3j
c2 = 4 + 5j
c3 = c1 + c2
assert c3 == 6 + 8j
c4 = c1 + 3
assert c4 == | 5 + 3j | assert | complex_expr | tests/cases/complex.py | complex_test | 10 | null | |
py2many/py2many | from typing import Callable, Dict, List, Set, Optional
from ctypes import c_int8 as i8, c_int16 as i16, c_int32 as i32, c_int64 as i64
from ctypes import c_uint8 as u8, c_uint16 as u16, c_uint32 as u32, c_uint64 as u64
import sys
from typing import List
def inline_pass():
pass
def inline_ellipsis(): ...
def inde... | 10 | assert | numeric_literal | tests/expected/coverage.py | show | 48 | null | |
py2many/py2many | import argparse
import logging
import os.path
import platform
import sys
from functools import lru_cache
from itertools import product
from pathlib import Path
from subprocess import run
from unittest.mock import Mock
import pytest
from py2many.cli import (
_create_cmd,
_get_all_settings,
_get_output_path... | standardise_eol( expected_contents ) | assert | func_call | tests/test_cli.py | test_directory | TestCodeGenerator | 517 | null |
py2many/py2many | def foo():
a = 10
# infer that b is an int
b = a
assert b == | 10 | assert | numeric_literal | tests/cases/infer.py | foo | 8 | null | |
py2many/py2many | import ast
import sys
import unittest
from py2many.inference import infer_types, infer_types_typpete
def parse(*args):
return ast.parse("\n".join(args))
class TestInferenceTyppete(unittest.TestCase):
def test_infer_types_print_exception(self):
tree = parse("print(10)")
if sys.version_info[1]... | NameError) | self.assertRaises | variable | tests/test_inference.py | test_infer_types_print_exception | TestInferenceTyppete | 36 | null |
py2many/py2many | import ast
from py2many.analysis import (
AttributeCallTransformer,
CalledWithTransformer,
FunctionTransformer,
ImportTransformer,
is_generator_function,
is_void_function,
)
from py2many.context import add_variable_context
from py2many.scope import add_scope_context
def parse(*args):
sourc... | 0 | assert | numeric_literal | tests/test_analysis.py | test_nested_functions | TestFunctionTransformer | 71 | null |
py2many/py2many | from typing import Callable, Dict, List, Set, Optional
from ctypes import c_int8 as i8, c_int16 as i16, c_int32 as i32, c_int64 as i64
from ctypes import c_uint8 as u8, c_uint16 as u16, c_uint32 as u32, c_uint64 as u64
import sys
def default_builtins():
a: str = str()
b: bool = bool()
c: int = int()
d:... | "" | assert | string_literal | tests/expected/built_ins.py | default_builtins | 12 | null | |
py2many/py2many | from typing import List
def inline_pass():
pass
def inline_ellipsis(): ...
def indexing():
sum = 0
a: List[int] = []
for i in range(10):
a.append(i)
sum += a[i]
return sum
def infer_bool(code: int):
return code in [1, 2, 4]
def show():
# assign
a1 = 10
# multi-as... | 11 | assert | numeric_literal | tests/cases/coverage.py | show | 78 | null | |
py2many/py2many | import ast
from py2many.analysis import (
AttributeCallTransformer,
CalledWithTransformer,
FunctionTransformer,
ImportTransformer,
is_generator_function,
is_void_function,
)
from py2many.context import add_variable_context
from py2many.scope import add_scope_context
def parse(*args):
sourc... | 1 | assert | numeric_literal | tests/test_analysis.py | test_nested_functions | TestFunctionTransformer | 69 | null |
py2many/py2many | from typing import Callable, Dict, List, Set, Optional
from ctypes import c_int8 as i8, c_int16 as i16, c_int32 as i32, c_int64 as i64
from ctypes import c_uint8 as u8, c_uint16 as u16, c_uint32 as u32, c_uint64 as u64
import sys
from ctypes import (
c_int8,
c_int16,
c_int32,
c_int64,
c_uint8,
c... | 12 | assert | numeric_literal | tests/expected/infer_ops.py | show | 83 | null | |
py2many/py2many | import textwrap
def parse(*args):
return "\n".join(args)
def test_declare_vars_inside_if_as_long_as_possible():
source = parse("x = 5", "if 10:", " y = 10", " x *= y")
cpp = transpile(source)
assert cpp == | parse("auto x = 5;", "if(10) {", "auto y = 10;", "x *= y;", "}") | assert | func_call | tests/test_transpiler_cpp.py | test_declare_vars_inside_if_as_long_as_possible | 75 | null | |
py2many/py2many | from typing import Callable, Dict, List, Set, Optional
from ctypes import c_int8 as i8, c_int16 as i16, c_int32 as i32, c_int64 as i64
from ctypes import c_uint8 as u8, c_uint16 as u16, c_uint32 as u32, c_uint64 as u64
import sys
from enum import IntEnum, IntFlag, auto
def show():
color_map: Dict[Colors, str] = {
... | 0 | assert | numeric_literal | tests/expected/int_enum.py | show | 36 | null | |
py2many/py2many | import ast
from py2many.context import add_list_calls, add_variable_context
from py2many.scope import add_scope_context
from py2many.tracer import is_list, is_recursive, value_expr, value_type
def parse(*args):
source = ast.parse("\n".join(args))
add_variable_context(source, (source,))
add_scope_context(s... | "x" | assert | string_literal | tests/test_tracer.py | test_assign_name | TestValueType | 26 | null |
py2many/py2many | from typing import Callable, Dict, List, Set, Optional
from ctypes import c_int8 as i8, c_int16 as i16, c_int32 as i32, c_int64 as i64
from ctypes import c_uint8 as u8, c_uint16 as u16, c_uint32 as u32, c_uint64 as u64
import sys
def compare_with_integer_variable():
i: int = 0
s: int = 1
if i:
s = ... | 3 | assert | numeric_literal | tests/expected/comparison.py | compare_with_integer_variable | 14 | null | |
py2many/py2many | import argparse
import logging
import os.path
import platform
import sys
from functools import lru_cache
from itertools import product
from pathlib import Path
from subprocess import run
from unittest.mock import Mock
import pytest
from py2many.cli import (
_create_cmd,
_get_all_settings,
_get_output_path... | Path("dir") / "foo.rs" | assert | func_call | tests/test_cli.py | test_output_path | TestCodeGenerator | 527 | null |
py2many/py2many | import os
import unittest
from pathlib import Path
from shutil import rmtree
from unittest.mock import Mock
from py2many.cli import _get_all_settings, _process_dir
from py2many.exceptions import (
AstNotImplementedError,
AstTypeNotSupported,
AstUnrecognisedBinOp,
)
SHOW_ERRORS = os.environ.get("SHOW_ERROR... | expected_success | assert | variable | tests/test_transpile_self.py | assert_no_failures | 33 | null | |
py2many/py2many | import ast
from py2many.context import add_list_calls, add_variable_context
from py2many.scope import add_scope_context
from py2many.tracer import is_recursive
def parse(*args):
source = ast.parse("\n".join(args))
add_variable_context(source, (source,))
add_scope_context(source)
return source
class T... | "x" | assert | string_literal | tests/test_tracer_cpp.py | test_assign_name | TestValueType | 31 | null |
py2many/py2many | from typing import Callable, Dict, List, Set, Optional
from ctypes import c_int8 as i8, c_int16 as i16, c_int32 as i32, c_int64 as i64
from ctypes import c_uint8 as u8, c_uint16 as u16, c_uint32 as u32, c_uint64 as u64
import sys
def complex_test():
c1: complex = 2 + 3j
c2: complex = 4 + 5j
c3: complex = c... | 6 + 8j | assert | complex_expr | tests/expected/complex.py | complex_test | 11 | null | |
py2many/py2many | import os
import unittest
from pathlib import Path
from shutil import rmtree
from unittest.mock import Mock
from py2many.cli import _get_all_settings, _process_dir
from py2many.exceptions import (
AstNotImplementedError,
AstTypeNotSupported,
AstUnrecognisedBinOp,
)
SHOW_ERRORS = os.environ.get("SHOW_ERROR... | *_process_dir( settings, transpiler_module, OUT_DIR, False, _suppress_exceptions=suppress_exceptions, )) | assert_* | func_call | tests/test_transpile_self.py | test_dlang_recursive | SelfTranspileTests | 110 | null |
py2many/py2many | import ast
from py2many.analysis import (
AttributeCallTransformer,
CalledWithTransformer,
FunctionTransformer,
ImportTransformer,
is_generator_function,
is_void_function,
)
from py2many.context import add_variable_context
from py2many.scope import add_scope_context
def parse(*args):
sourc... | 2 | assert | numeric_literal | tests/test_analysis.py | test_nested_functions | TestFunctionTransformer | 70 | null |
py2many/py2many | import textwrap
def parse(*args):
return "\n".join(args)
def test_augmented_assigns_with_counter():
source = parse(
"counter = 0", "counter += 5", "counter -= 2", "counter *= 2", "counter /= 3"
)
cpp = transpile(source)
assert cpp == | parse( "auto counter = 0;", "counter += 5;", "counter -= 2;", "counter *= 2;", "counter /= 3;", ) | assert | func_call | tests/test_transpiler_cpp.py | test_augmented_assigns_with_counter | 49 | null | |
py2many/py2many | import ast
import os.path
import sys
from functools import lru_cache, partial
from itertools import product
from subprocess import run
from textwrap import dedent
from unittest.mock import Mock
import pytest
from test_cli import BUILD_DIR, COMPILERS, ENV, GENERATED_DIR, INVOKER, KEEP_GENERATED
from test_cli import LA... | result | assert | variable | tests/test_unsupported.py | test_comment_unimplemented_body | TestCodeGenerator | 388 | null |
py2many/py2many | from typing import Callable, Dict, List, Set, Optional
from ctypes import c_int8 as i8, c_int16 as i16, c_int32 as i32, c_int64 as i64
from ctypes import c_uint8 as u8, c_uint16 as u16, c_uint32 as u32, c_uint64 as u64
import sys
from typing import List
def inline_pass():
pass
def inline_ellipsis(): ...
def inde... | b10 | assert | variable | tests/expected/coverage.py | show | 37 | null | |
py2many/py2many | import ast
import sys
import unittest
from py2many.inference import infer_types, infer_types_typpete
def parse(*args):
return ast.parse("\n".join(args))
class TestInference:
def test_infer_types(self):
tree = parse("a = [10, 20]")
assert not hasattr(tree.body[0].targets[0], "annotation")
... | "int" | assert | string_literal | tests/test_inference.py | test_infer_types | TestInference | 20 | null |
py2many/py2many | from typing import List
def main():
ands: List[bool] = []
ors: List[bool] = []
xors: List[bool] = []
for a in [False, True]:
for b in [False, True]:
ands.append(a & b)
ors.append(a | b)
xors.append(a ^ b)
assert ands == [False, False, False, True]
ass... | [False, True, True, False] | assert | collection | tests/cases/bitops.py | main | 17 | null | |
py2many/py2many | import ast
from py2many.context import add_list_calls, add_variable_context
from py2many.scope import add_scope_context
from py2many.tracer import is_recursive
def parse(*args):
source = ast.parse("\n".join(args))
add_variable_context(source, (source,))
add_scope_context(source)
return source
def tes... | "decltype(foo(x))" | assert | string_literal | tests/test_tracer_cpp.py | test_decltype_normal_var | 91 | null | |
py2many/py2many | def default_builtins():
a = str()
b = bool()
c = int()
d = float()
assert a == ""
assert b == False
assert c == | 0 | assert | numeric_literal | tests/cases/built_ins.py | default_builtins | 11 | null | |
py2many/py2many | import textwrap
def parse(*args):
return "\n".join(args)
def test_print_program_args():
source = parse(
'if __name__ == "__main__":', " for arg in sys.argv:", " print(arg)"
)
cpp = transpile(source)
# Note the args and return type are missing here as this `transpile` wrapper
#... | parse( "void main() {", "for(auto arg : std::vector<std::string>(argv, argv + argc)) {", "std::cout << arg;", "std::cout << std::endl;", "}}", "", ) | assert | func_call | tests/test_transpiler_cpp.py | test_print_program_args | 85 | null | |
py2many/py2many | import ast
from py2many.context import add_list_calls, add_variable_context
from py2many.scope import add_scope_context
from py2many.tracer import is_list, is_recursive, value_expr, value_type
def parse(*args):
source = ast.parse("\n".join(args))
add_variable_context(source, (source,))
add_scope_context(s... | "foo(3 * 1) + 2" | assert | string_literal | tests/test_tracer.py | test_catch_expression_chain_with_functions | TestValueExpr | 79 | null |
py2many/py2many | def default_builtins():
a = str()
b = bool()
c = int()
d = float()
assert a == ""
assert b == False
assert c == 0
assert d == | 0.0 | assert | numeric_literal | tests/cases/built_ins.py | default_builtins | 12 | null | |
py2many/py2many | import ast
import sys
import unittest
from py2many.inference import infer_types, infer_types_typpete
def parse(*args):
return ast.parse("\n".join(args))
class TestInferenceTyppete(unittest.TestCase):
def test_infer_types_list_failure(self):
tree = parse("a = [10, 20]")
if sys.version_info[1] ... | AttributeError) | self.assertRaises | variable | tests/test_inference.py | test_infer_types_list_failure | TestInferenceTyppete | 30 | null |
py2many/py2many | from py2many.smt import check_sat, default_value, get_value
from py2many.smt import pre as smt_pre
x: int = default_value(int)
y: int = default_value(int)
z: float = default_value(float)
def equation(x: int, y: int) -> bool:
if smt_pre:
assert x > 2
assert y < | 10 | assert | numeric_literal | tests/cases/equations.py | equation | 12 | null | |
py2many/py2many | import argparse
import logging
import os.path
import platform
import sys
from functools import lru_cache
from itertools import product
from pathlib import Path
from subprocess import run
from unittest.mock import Mock
import pytest
from py2many.cli import (
_create_cmd,
_get_all_settings,
_get_output_path... | exit_code | assert | variable | tests/test_cli.py | get_python_case_output | 152 | null | |
py2many/py2many | def default_builtins():
a = str()
b = bool()
c = int()
d = float()
assert a == | "" | assert | string_literal | tests/cases/built_ins.py | default_builtins | 9 | null | |
py2many/py2many | import ast
from py2many.context import add_list_calls, add_variable_context
from py2many.scope import add_scope_context
from py2many.tracer import is_recursive
def parse(*args):
source = ast.parse("\n".join(args))
add_variable_context(source, (source,))
add_scope_context(source)
return source
class T... | "3 * 1 - 5 + 2" | assert | string_literal | tests/test_tracer_cpp.py | test_catch_long_expression_chain | TestValueExpr | 78 | null |
py2many/py2many | from enum import IntEnum, IntFlag, auto
def show():
color_map = {Colors.RED: "red", Colors.GREEN: "green", Colors.BLUE: "blue"}
a = Colors.GREEN
if a == Colors.GREEN:
print("green")
else:
print("Not green")
b = Permissions.R
if b == Permissions.R:
print("R")
else:
... | 0 | assert | numeric_literal | tests/cases/int_enum.py | show | 30 | null | |
py2many/py2many | import argparse
import logging
import os.path
import platform
import sys
from functools import lru_cache
from itertools import product
from pathlib import Path
from subprocess import run
from unittest.mock import Mock
import pytest
from py2many.cli import (
_create_cmd,
_get_all_settings,
_get_output_path... | 0 | assert | numeric_literal | tests/test_cli.py | test_generated | TestCodeGenerator | 267 | null |
py2many/py2many | from typing import Callable, Dict, List, Set, Optional
from ctypes import c_int8 as i8, c_int16 as i16, c_int32 as i32, c_int64 as i64
from ctypes import c_uint8 as u8, c_uint16 as u16, c_uint32 as u32, c_uint64 as u64
import sys
def show():
try:
raise Exception("foo")
except Exception as e:
pr... | str(e) | assert | func_call | tests/expected/exceptions.py | show | 21 | null | |
py2many/py2many | from typing import Callable, Dict, List, Set, Optional
from ctypes import c_int8 as i8, c_int16 as i16, c_int32 as i32, c_int64 as i64
from ctypes import c_uint8 as u8, c_uint16 as u16, c_uint32 as u32, c_uint64 as u64
import sys
from typing import List
def main_func():
ands: List[bool] = []
ors: List[bool] = ... | [False, True, True, False] | assert | collection | tests/expected/bitops.py | main_func | 19 | null | |
py2many/py2many | from typing import List
def inline_pass():
pass
def inline_ellipsis(): ...
def indexing():
sum = 0
a: List[int] = []
for i in range(10):
a.append(i)
sum += a[i]
return sum
def infer_bool(code: int):
return code in [1, 2, 4]
def show():
# assign
a1 = 10
# multi-as... | b10 | assert | variable | tests/cases/coverage.py | show | 33 | null | |
py2many/py2many | from typing import Callable, Dict, List, Set, Optional
from ctypes import c_int8 as i8, c_int16 as i16, c_int32 as i32, c_int64 as i64
from ctypes import c_uint8 as u8, c_uint16 as u16, c_uint32 as u32, c_uint64 as u64
import sys
from typing import List
def inline_pass():
pass
def inline_ellipsis(): ...
def inde... | 15 | assert | numeric_literal | tests/expected/coverage.py | show | 33 | null | |
py2many/py2many | import ast
from py2many.context import add_list_calls, add_variable_context
from py2many.scope import add_scope_context
def parse(*args):
source = ast.parse("\n".join(args))
add_scope_context(source)
add_variable_context(source, (source,))
return source
class TestVariableTranformer:
def test_loc... | 3 | assert | numeric_literal | tests/test_context.py | test_local_vars_of_function | TestVariableTranformer | 51 | null |
py2many/py2many | import ast
from py2many.context import add_list_calls, add_variable_context
from py2many.scope import add_scope_context
def parse(*args):
source = ast.parse("\n".join(args))
add_scope_context(source)
add_variable_context(source, (source,))
return source
class TestVariableTranformer:
def test_vars... | 2 | assert | numeric_literal | tests/test_context.py | test_vars_of_if | TestVariableTranformer | 25 | null |
joouha/euporie | from __future__ import annotations
from typing import TYPE_CHECKING, cast
from unittest.mock import Mock, call, patch
import pytest
from euporie.core.comm.ipywidgets import (
WIDGET_MODELS,
IpyWidgetComm,
UnimplementedModel,
_separate_buffers,
)
from euporie.core.kernel.jupyter import JupyterKernel
f... | {"b": [None, {}], "d": "string"} | assert | collection | tests/test_core_comm_ipywidgets.py | test_separate_buffers | 78 | null | |
joouha/euporie | from __future__ import annotations
from typing import TYPE_CHECKING, cast
from unittest.mock import Mock, call, patch
import pytest
from euporie.core.comm.ipywidgets import (
WIDGET_MODELS,
IpyWidgetComm,
UnimplementedModel,
_separate_buffers,
)
from euporie.core.kernel.jupyter import JupyterKernel
f... | "mymodule" | assert | string_literal | tests/test_core_comm_ipywidgets.py | test_get_embed_state | TestIpyWidgetComm | 161 | null |
joouha/euporie | from __future__ import annotations
import asyncio
import sys
from typing import TYPE_CHECKING
import pytest
from euporie.core import async_utils
def reset_loops_threads() -> Generator[None, None, None]:
"""Clean up internal state between tests.
Yields:
None
"""
async_utils._LOOPS.clear()
... | RuntimeError, match="run_coro_sync requires a loop argument") | pytest.raises | complex_expr | tests/test_async_utils.py | test_run_coro_sync_raises_if_no_loop | 110 | null | |
joouha/euporie | from __future__ import annotations
from typing import TYPE_CHECKING
from prompt_toolkit.formatted_text.base import FormattedText as Ft
from prompt_toolkit.formatted_text.utils import to_plain_text
from euporie.core.data_structures import DiBool
from euporie.core.ft import utils
def test_max_line_width() -> None:
... | 3 | assert | numeric_literal | tests/test_core_ft_utils.py | test_max_line_width | 48 | null | |
joouha/euporie | from euporie.core.layout.containers import DimensionTuple, distribute_dimensions
def test_distribute_dimensions_preferred() -> None:
"""Test distribution up to preferred sizes."""
dims = (
DimensionTuple(min=2, max=10, preferred=5),
DimensionTuple(min=3, max=12, preferred=6),
)
assert ... | [5, 6] | assert | collection | tests/test_core_layout_containers.py | test_distribute_dimensions_preferred | 35 | null | |
joouha/euporie | from __future__ import annotations
from prompt_toolkit.formatted_text import to_formatted_text
from euporie.core.ft.ansi import ANSI
def test_ansi_misc_escape_sequences() -> None:
"""Miscellaneous escape sequence are converted to zero-width-escape sequences."""
value = ANSI("a\x1b[0cb")
assert to_format... | [ ("", "a"), ("[ZeroWidthEscape]", "\x1b[0c"), ("", "b"), ] | assert | collection | tests/test_core_ft_ansi.py | test_ansi_misc_escape_sequences | 107 | null | |
joouha/euporie | from __future__ import annotations
import asyncio
import sys
from typing import TYPE_CHECKING
import pytest
from euporie.core import async_utils
def reset_loops_threads() -> Generator[None, None, None]:
"""Clean up internal state between tests.
Yields:
None
"""
async_utils._LOOPS.clear()
... | 2 | assert | numeric_literal | tests/test_async_utils.py | test_run_coro_async_cancel_previous | 174 | null | |
joouha/euporie | from __future__ import annotations
from typing import TYPE_CHECKING
from prompt_toolkit.formatted_text.base import FormattedText as Ft
from prompt_toolkit.formatted_text.utils import to_plain_text
from euporie.core.data_structures import DiBool
from euporie.core.ft import utils
def test_valign() -> None:
"""Tes... | " \nA\n " | assert | string_literal | tests/test_core_ft_utils.py | test_valign | 202 | null | |
joouha/euporie | from __future__ import annotations
import asyncio
import sys
from typing import TYPE_CHECKING
import pytest
from euporie.core import async_utils
def reset_loops_threads() -> Generator[None, None, None]:
"""Clean up internal state between tests.
Yields:
None
"""
async_utils._LOOPS.clear()
... | [42] | assert | collection | tests/test_async_utils.py | test_run_coro_async_normal | 145 | null | |
joouha/euporie | from __future__ import annotations
from typing import cast
from unittest.mock import Mock, call, patch
import pytest
from prompt_toolkit.layout.containers import Window
from euporie.core.comm.base import Comm, CommView, UnimplementedComm
from euporie.core.tabs.kernel import KernelTab
from euporie.core.widgets.displa... | None | assert | none_literal | tests/test_core_comm_base.py | test_init | TestCommView | 48 | null |
joouha/euporie | from __future__ import annotations
import asyncio
import sys
from typing import TYPE_CHECKING
import pytest
from euporie.core import async_utils
def reset_loops_threads() -> Generator[None, None, None]:
"""Clean up internal state between tests.
Yields:
None
"""
async_utils._LOOPS.clear()
... | {"one", "two"} | assert | collection | tests/test_async_utils.py | test_get_or_create_loop_creates_new_thread_for_new_name | 60 | null | |
joouha/euporie | from __future__ import annotations
import gc
from unittest.mock import PropertyMock, patch
from PIL import Image
from prompt_toolkit.application.current import set_app
from prompt_toolkit.data_structures import Size
from euporie.core.app.dummy import DummyApp
from euporie.core.convert.datum import Datum
async def t... | 32 | assert | numeric_literal | tests/test_core_convert_datum.py | test_cell_size_async | 88 | null | |
joouha/euporie | from __future__ import annotations
from typing import TYPE_CHECKING
from prompt_toolkit.formatted_text.base import FormattedText as Ft
from prompt_toolkit.formatted_text.utils import to_plain_text
from euporie.core.data_structures import DiBool
from euporie.core.ft import utils
def test_last_char() -> None:
"""... | "C" | assert | string_literal | tests/test_core_ft_utils.py | test_last_char | 63 | null | |
joouha/euporie | from __future__ import annotations
from prompt_toolkit.formatted_text import to_formatted_text
from euporie.core.ft.ansi import ANSI
def test_ansi_carriage_returns() -> None:
"""Line text preceding carriage returns is removed."""
value = ANSI("a\nb\rc")
assert to_formatted_text(value) == | [("", "a"), ("", "\n"), ("", "c")] | assert | collection | tests/test_core_ft_ansi.py | test_ansi_carriage_returns | 45 | null | |
joouha/euporie | from __future__ import annotations
from prompt_toolkit.formatted_text import to_formatted_text
from euporie.core.ft.ansi import ANSI
def test_ansi_backspace() -> None:
"""Characters preceding backspace characters are removed."""
value = ANSI("ab\x08c")
assert to_formatted_text(value) == | [ ("", "a"), ("", "c"), ] | assert | collection | tests/test_core_ft_ansi.py | test_ansi_backspace | 74 | null | |
joouha/euporie | from __future__ import annotations
from typing import TYPE_CHECKING, cast
from unittest.mock import Mock, call, patch
import pytest
from euporie.core.comm.ipywidgets import (
WIDGET_MODELS,
IpyWidgetComm,
UnimplementedModel,
_separate_buffers,
)
from euporie.core.kernel.jupyter import JupyterKernel
f... | expected_output_state | assert | variable | tests/test_core_comm_ipywidgets.py | test_get_embed_state | TestIpyWidgetComm | 163 | null |
joouha/euporie | import pytest
from euporie.core.style import ColorPalette, ColorPaletteColor
test_colors = {
"red": "#FF0000",
"green": "#00FF00",
"blue": "#0000FF",
}
def color_palette() -> ColorPalette:
"""Fixture for creating a ColorPalette with test colors."""
palette = ColorPalette()
for name, color in ... | {} | assert | collection | tests/test_core_style.py | test_color_palette_add_color | 27 | null | |
joouha/euporie | import pytest
from euporie.core.style import ColorPalette, ColorPaletteColor
test_colors = {
"red": "#FF0000",
"green": "#00FF00",
"blue": "#0000FF",
}
def color_palette() -> ColorPalette:
"""Fixture for creating a ColorPalette with test colors."""
palette = ColorPalette()
for name, color in ... | red.base_hex | assert | complex_expr | tests/test_core_style.py | test_color_palette_color_adjustments | 53 | null | |
joouha/euporie | from __future__ import annotations
from prompt_toolkit.data_structures import Point
from prompt_toolkit.mouse_events import MouseButton, MouseEvent, MouseEventType
from euporie.core.utils import ChainedList, dict_merge, on_click
def test_ChainedList() -> None:
"""Test ChainedList."""
cl = ChainedList([1, 2, ... | 4 | assert | numeric_literal | tests/test_core_utils.py | test_ChainedList | 15 | null | |
joouha/euporie | from __future__ import annotations
from prompt_toolkit.formatted_text import to_formatted_text
from euporie.core.ft.ansi import ANSI
def test_ansi_win_newlines() -> None:
"""Windows newlines are converted to Unix newlines."""
value = ANSI("a\nb\r\nc")
assert to_formatted_text(value) == | [ ("", "a"), ("", "\n"), ("", "b"), ("", "\n"), ("", "c"), ] | assert | collection | tests/test_core_ft_ansi.py | test_ansi_win_newlines | 33 | null | |
joouha/euporie | import pytest
from euporie.core.style import ColorPalette, ColorPaletteColor
test_colors = {
"red": "#FF0000",
"green": "#00FF00",
"blue": "#0000FF",
}
def color_palette() -> ColorPalette:
"""Fixture for creating a ColorPalette with test colors."""
palette = ColorPalette()
for name, color in ... | KeyError) | pytest.raises | variable | tests/test_core_style.py | test_color_palette_access_invalid_color | 42 | null | |
joouha/euporie | from __future__ import annotations
from typing import TYPE_CHECKING
from prompt_toolkit.formatted_text.base import FormattedText as Ft
from prompt_toolkit.formatted_text.utils import to_plain_text
from euporie.core.data_structures import DiBool
from euporie.core.ft import utils
def test_concat() -> None:
"""Con... | 1 | assert | numeric_literal | tests/test_core_ft_utils.py | test_concat | 283 | null | |
joouha/euporie | from __future__ import annotations
from typing import cast
from unittest.mock import Mock, call, patch
import pytest
from prompt_toolkit.layout.containers import Window
from euporie.core.comm.base import Comm, CommView, UnimplementedComm
from euporie.core.tabs.kernel import KernelTab
from euporie.core.widgets.displa... | setters | assert | variable | tests/test_core_comm_base.py | test_init | TestCommView | 47 | null |
joouha/euporie | from __future__ import annotations
import asyncio
from typing import TYPE_CHECKING, cast
from unittest.mock import Mock
import pytest
from prompt_toolkit.application.application import Application
from prompt_toolkit.application.current import set_app
from prompt_toolkit.formatted_text.base import to_formatted_text
f... | [("", "A, B")] | assert | collection | tests/test_core_commands.py | test_command_menu | 244 | null | |
joouha/euporie | from __future__ import annotations
from typing import cast
from unittest.mock import Mock, call, patch
import pytest
from prompt_toolkit.layout.containers import Window
from euporie.core.comm.base import Comm, CommView, UnimplementedComm
from euporie.core.tabs.kernel import KernelTab
from euporie.core.widgets.displa... | [call(changes)] | assert | collection | tests/test_core_comm_base.py | test_update_views | TestComm | 110 | null |
joouha/euporie | from __future__ import annotations
from typing import cast
from euporie.core.data_structures import (
DiBool,
DiInt,
DiStr,
WeightedDiInt,
WeightedInt,
)
def test_WeightedDiInt() -> None:
"""Test the WeightedDiInt data structure."""
d = WeightedDiInt(
top=WeightedInt(weight=2, val... | 6 | assert | numeric_literal | tests/test_core_data_structures.py | test_WeightedDiInt | 79 | null | |
joouha/euporie | from euporie.core.layout.containers import DimensionTuple, distribute_dimensions
def test_distribute_dimensions_with_fixed_and_flexible() -> None:
"""Test distribution with one fixed size and two flexible dimensions."""
dims = (
# Fixed size dimension
DimensionTuple(min=5, max=5, preferred=5),
... | [5, 5, 5] | assert | collection | tests/test_core_layout_containers.py | test_distribute_dimensions_with_fixed_and_flexible | 69 | null | |
joouha/euporie | from __future__ import annotations
from typing import TYPE_CHECKING
from prompt_toolkit.formatted_text.base import FormattedText as Ft
from prompt_toolkit.formatted_text.utils import to_plain_text
from euporie.core.data_structures import DiBool
from euporie.core.ft import utils
def test_valign() -> None:
"""Tes... | "A\n \n " | assert | string_literal | tests/test_core_ft_utils.py | test_valign | 197 | null | |
joouha/euporie | from __future__ import annotations
from euporie.core.convert.utils import call_subproc
async def test_call_subproc() -> None:
"""Test calling a sub-process."""
# Call the function and check the output
assert (await call_subproc("Test", ["cat"], use_tempfile=False)) == | b"Test" | assert | string_literal | tests/test_core_convert_utils.py | test_call_subproc | 11 | null | |
joouha/euporie | from __future__ import annotations
import asyncio
from typing import TYPE_CHECKING, cast
from unittest.mock import Mock
import pytest
from prompt_toolkit.application.application import Application
from prompt_toolkit.application.current import set_app
from prompt_toolkit.formatted_text.base import to_formatted_text
f... | [("a",)] | assert | collection | tests/test_core_commands.py | test_command_bind | 197 | null | |
joouha/euporie | from __future__ import annotations
from prompt_toolkit.data_structures import Point
from prompt_toolkit.mouse_events import MouseButton, MouseEvent, MouseEventType
from euporie.core.utils import ChainedList, dict_merge, on_click
def test_on_click() -> None:
"""Test on_click."""
result = ""
def click_han... | NotImplemented | assert | variable | tests/test_core_utils.py | test_on_click | 39 | null | |
joouha/euporie | from __future__ import annotations
import asyncio
from typing import TYPE_CHECKING, cast
from unittest.mock import Mock
import pytest
from prompt_toolkit.application.application import Application
from prompt_toolkit.application.current import set_app
from prompt_toolkit.formatted_text.base import to_formatted_text
f... | [] | assert | collection | tests/test_core_commands.py | test_command_init | 56 | null | |
joouha/euporie | from __future__ import annotations
from typing import TYPE_CHECKING
from prompt_toolkit.formatted_text.base import FormattedText as Ft
from prompt_toolkit.formatted_text.utils import to_plain_text
from euporie.core.data_structures import DiBool
from euporie.core.ft import utils
def test_fragment_list_width() -> Non... | 2 | assert | numeric_literal | tests/test_core_ft_utils.py | test_fragment_list_width | 21 | null | |
joouha/euporie | from __future__ import annotations
import asyncio
from typing import TYPE_CHECKING, cast
from unittest.mock import Mock
import pytest
from prompt_toolkit.application.application import Application
from prompt_toolkit.application.current import set_app
from prompt_toolkit.formatted_text.base import to_formatted_text
f... | "Test Command Menu Title" | assert | string_literal | tests/test_core_commands.py | test_command_menu | 242 | null | |
joouha/euporie | from __future__ import annotations
from typing import TYPE_CHECKING, cast
from unittest.mock import Mock, call, patch
import pytest
from euporie.core.comm.ipywidgets import (
WIDGET_MODELS,
IpyWidgetComm,
UnimplementedModel,
_separate_buffers,
)
from euporie.core.kernel.jupyter import JupyterKernel
f... | { "state": { "key_1": "value_1", "key_2": b"buffer_1", "key_3": {"nested_key_1": "nested_value", "nested_key_2": b"buffer_2"}, }, "buffer_paths": data["buffer_paths"], } | assert | collection | tests/test_core_comm_ipywidgets.py | test_process_data | TestIpyWidgetComm | 115 | null |
joouha/euporie | from __future__ import annotations
import asyncio
from typing import TYPE_CHECKING, cast
from unittest.mock import Mock
import pytest
from prompt_toolkit.application.application import Application
from prompt_toolkit.application.current import set_app
from prompt_toolkit.formatted_text.base import to_formatted_text
f... | False | assert | bool_literal | tests/test_core_commands.py | test_command_init | 47 | null | |
joouha/euporie | from euporie.core.layout.containers import DimensionTuple, distribute_dimensions
def test_distribute_dimensions_custom_distribution() -> None:
"""Test distribution with uneven dimension requirements."""
dims = (
DimensionTuple(min=0, max=9999, preferred=0),
DimensionTuple(min=0, max=1, preferre... | [3, 1, 1, 20, 1, 1, 3] | assert | collection | tests/test_core_layout_containers.py | test_distribute_dimensions_custom_distribution | 93 | null | |
joouha/euporie | from __future__ import annotations
import gc
from unittest.mock import PropertyMock, patch
from PIL import Image
from prompt_toolkit.application.current import set_app
from prompt_toolkit.data_structures import Size
from euporie.core.app.dummy import DummyApp
from euporie.core.convert.datum import Datum
async def t... | result | assert | variable | tests/test_core_convert_datum.py | test_convert_caching | 62 | null | |
joouha/euporie | from __future__ import annotations
from typing import cast
from unittest.mock import Mock, call, patch
import pytest
from prompt_toolkit.layout.containers import Window
from euporie.core.comm.base import Comm, CommView, UnimplementedComm
from euporie.core.tabs.kernel import KernelTab
from euporie.core.widgets.displa... | container | assert | variable | tests/test_core_comm_base.py | test_init | TestCommView | 46 | null |
joouha/euporie | from __future__ import annotations
from typing import TYPE_CHECKING, cast
from unittest.mock import Mock, call, patch
import pytest
from euporie.core.comm.ipywidgets import (
WIDGET_MODELS,
IpyWidgetComm,
UnimplementedModel,
_separate_buffers,
)
from euporie.core.kernel.jupyter import JupyterKernel
f... | 3 | assert | numeric_literal | tests/test_core_comm_ipywidgets.py | test_separate_buffers | 80 | null | |
joouha/euporie | from __future__ import annotations
from typing import TYPE_CHECKING
from prompt_toolkit.formatted_text.base import FormattedText as Ft
from prompt_toolkit.formatted_text.utils import to_plain_text
from euporie.core.data_structures import DiBool
from euporie.core.ft import utils
def test_valign() -> None:
"""Tes... | " \n \nA" | assert | string_literal | tests/test_core_ft_utils.py | test_valign | 207 | null | |
joouha/euporie | from __future__ import annotations
from typing import cast
from unittest.mock import Mock, call, patch
import pytest
from prompt_toolkit.layout.containers import Window
from euporie.core.comm.base import Comm, CommView, UnimplementedComm
from euporie.core.tabs.kernel import KernelTab
from euporie.core.widgets.displa... | 0 | assert | numeric_literal | tests/test_core_comm_base.py | test_update | TestCommView | 66 | null |
joouha/euporie | from __future__ import annotations
import asyncio
from typing import TYPE_CHECKING, cast
from unittest.mock import Mock
import pytest
from prompt_toolkit.application.application import Application
from prompt_toolkit.application.current import set_app
from prompt_toolkit.formatted_text.base import to_formatted_text
f... | KeyError) | pytest.raises | variable | tests/test_core_commands.py | test_get_cmd | 281 | null | |
joouha/euporie | from __future__ import annotations
from typing import TYPE_CHECKING
from prompt_toolkit.formatted_text.base import FormattedText as Ft
from prompt_toolkit.formatted_text.utils import to_plain_text
from euporie.core.data_structures import DiBool
from euporie.core.ft import utils
def test_add_border() -> None:
""... | "│A│" | assert | string_literal | tests/test_core_ft_utils.py | test_add_border | 325 | null | |
joouha/euporie | from __future__ import annotations
from typing import cast
from euporie.core.data_structures import (
DiBool,
DiInt,
DiStr,
WeightedDiInt,
WeightedInt,
)
def test_DiStr() -> None:
"""Test the DiStr data structure."""
d = DiStr(top="a", right="b", bottom="c", left="d")
assert d.top == ... | "b" | assert | string_literal | tests/test_core_data_structures.py | test_DiStr | 50 | null | |
joouha/euporie | from __future__ import annotations
import asyncio
from typing import TYPE_CHECKING, cast
from unittest.mock import Mock
import pytest
from prompt_toolkit.application.application import Application
from prompt_toolkit.application.current import set_app
from prompt_toolkit.formatted_text.base import to_formatted_text
f... | "Alt+A" | assert | string_literal | tests/test_core_commands.py | test_key_str | 215 | null | |
joouha/euporie | from __future__ import annotations
import asyncio
import sys
from typing import TYPE_CHECKING
import pytest
from euporie.core import async_utils
def reset_loops_threads() -> Generator[None, None, None]:
"""Clean up internal state between tests.
Yields:
None
"""
async_utils._LOOPS.clear()
... | 123 | assert | numeric_literal | tests/test_async_utils.py | test_run_coro_async_pyodide | 211 | null | |
joouha/euporie | import pytest
from euporie.core.style import ColorPalette, ColorPaletteColor
test_colors = {
"red": "#FF0000",
"green": "#00FF00",
"blue": "#0000FF",
}
def color_palette() -> ColorPalette:
"""Fixture for creating a ColorPalette with test colors."""
palette = ColorPalette()
for name, color in ... | palette.colors | assert | complex_expr | tests/test_core_style.py | test_color_palette_add_color | 29 | null | |
joouha/euporie | from __future__ import annotations
from prompt_toolkit.data_structures import Point
from prompt_toolkit.mouse_events import MouseButton, MouseEvent, MouseEventType
from euporie.core.utils import ChainedList, dict_merge, on_click
def test_ChainedList() -> None:
"""Test ChainedList."""
cl = ChainedList([1, 2, ... | [2, 3, 4] | assert | collection | tests/test_core_utils.py | test_ChainedList | 16 | null | |
joouha/euporie | from __future__ import annotations
from prompt_toolkit.data_structures import Point
from prompt_toolkit.mouse_events import MouseButton, MouseEvent, MouseEventType
from euporie.core.utils import ChainedList, dict_merge, on_click
def test_on_click() -> None:
"""Test on_click."""
result = ""
def click_han... | "Clicked!" | assert | string_literal | tests/test_core_utils.py | test_on_click | 78 | null | |
joouha/euporie | from euporie.core.layout.containers import DimensionTuple, distribute_dimensions
def test_distribute_dimensions_weights() -> None:
"""Test distribution considering weights."""
dims = (
DimensionTuple(min=2, max=10, preferred=4, weight=1),
DimensionTuple(min=2, max=10, preferred=4, weight=2),
... | [5, 7] | assert | collection | tests/test_core_layout_containers.py | test_distribute_dimensions_weights | 45 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.