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 |
|---|---|---|---|---|---|---|---|---|---|
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... | datum.data | assert | complex_expr | tests/test_core_convert_datum.py | test_convert | 39 | 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()
... | loop | assert | variable | tests/test_async_utils.py | test_get_or_create_loop_pyodide | 83 | null | |
joouha/euporie | from __future__ import annotations
from typing import cast
from euporie.core.data_structures import (
DiBool,
DiInt,
DiStr,
WeightedDiInt,
WeightedInt,
)
def test_DiInt() -> None:
"""Test the DiInt data structure."""
d = DiInt(top=1, right=2, bottom=3, left=4)
assert d.top == 1
as... | 5 | assert | numeric_literal | tests/test_core_data_structures.py | test_DiInt | 40 | 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... | True | assert | bool_literal | tests/test_core_commands.py | test_command_init | 46 | null | |
joouha/euporie | from __future__ import annotations
from io import BytesIO
from pathlib import Path
from typing import TYPE_CHECKING
from unittest.mock import MagicMock, patch
import magic
from fsspec.implementations.http import HTTPFileSystem
from upath import UPath
from upath.implementations.http import HTTPPath
from euporie.core.... | "image/gif" | assert | string_literal | tests/test_core_convert_mime.py | test_get_mime | 51 | null | |
joouha/euporie | from __future__ import annotations
from io import BytesIO
from pathlib import Path
from typing import TYPE_CHECKING
from unittest.mock import MagicMock, patch
import magic
from fsspec.implementations.http import HTTPFileSystem
from upath import UPath
from upath.implementations.http import HTTPPath
from euporie.core.... | "ansi" | assert | string_literal | tests/test_core_convert_mime.py | test_get_format | 89 | 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... | None | assert | none_literal | tests/test_core_commands.py | test_command_init | 52 | 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()
... | prev_tasks | assert | variable | tests/test_async_utils.py | test_run_coro_async_previous_tasks_tracking | 190 | null | |
joouha/euporie | from __future__ import annotations
from prompt_toolkit.formatted_text.base import to_formatted_text
from prompt_toolkit.formatted_text.utils import to_plain_text
from euporie.core.ft.html import HTML
def test_hidden() -> None:
"""Text with ``visibility: hidden`` is rendered as spaces."""
data = '<u style="vi... | style.find("underline") | assert | func_call | tests/test_core_ft_html.py | test_hidden | 50 | 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_zwe() -> None:
"""Escaped text is converted to zero width escape sequence."""
# Zero width escapes.
value = ANSI("a\001b\002c")
assert to_formatted_text(... | [ ("", "a"), ("[ZeroWidthEscape]", "b"), ("", "c"), ] | assert | collection | tests/test_core_ft_ansi.py | test_ansi_zwe | 64 | 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... | "" | assert | string_literal | tests/test_core_utils.py | test_on_click | 50 | 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_bold() -> None:
"""ANSI color bold is applied."""
value = ANSI("\x1b[1mhe\x1b[0mllo")
assert to_formatted_text(value) == | [ ("bold", "h"), ("bold", "e"), ("", "l"), ("", "l"), ("", "o"), ] | assert | collection | tests/test_core_ft_ansi.py | test_ansi_bold | 95 | 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... | "Ctrl+A" | assert | string_literal | tests/test_core_commands.py | test_key_str | 207 | null | |
joouha/euporie | from __future__ import annotations
from typing import cast
from euporie.core.data_structures import (
DiBool,
DiInt,
DiStr,
WeightedDiInt,
WeightedInt,
)
def test_DiInt() -> None:
"""Test the DiInt data structure."""
d = DiInt(top=1, right=2, bottom=3, left=4)
assert d.top == 1
as... | 4 | assert | numeric_literal | tests/test_core_data_structures.py | test_DiInt | 37 | 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... | ("new_value1",) | assert | collection | tests/test_core_comm_base.py | test_update | TestCommView | 63 | 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... | "ansi" | assert | string_literal | tests/test_core_comm_base.py | test_create_view | TestComm | 95 | 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 ==... | "a" | assert | string_literal | tests/test_core_data_structures.py | test_DiStr | 49 | 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()
... | loop2 | assert | variable | tests/test_async_utils.py | test_get_or_create_loop_returns_same_loop | 50 | 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... | None | assert | none_literal | tests/test_core_utils.py | test_on_click | 67 | null | |
joouha/euporie | from __future__ import annotations
from unittest.mock import Mock
from prompt_toolkit.application.current import get_app_session, set_app
from euporie.core.app.app import BaseApp
from euporie.core.app.current import get_app
def test_get_app_with_running_session() -> None:
"""Test get_app when there is a running... | app | assert | variable | tests/test_core_current.py | test_get_app_with_running_session | 17 | 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()
... | thread_names | assert | variable | tests/test_async_utils.py | test_get_or_create_loop_thread_names | 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_max_line_width() -> None:
... | 5 | assert | numeric_literal | tests/test_core_ft_utils.py | test_max_line_width | 44 | 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
def test_da... | datum_2 | assert | variable | tests/test_core_convert_datum.py | test_datum_new | 21 | 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... | buffers | assert | variable | tests/test_core_comm_ipywidgets.py | test_process_data | TestIpyWidgetComm | 114 | null |
joouha/euporie | from __future__ import annotations
from prompt_toolkit.formatted_text.base import to_formatted_text
from prompt_toolkit.formatted_text.utils import to_plain_text
from euporie.core.ft.html import HTML
def test_hidden() -> None:
"""Text with ``visibility: hidden`` is rendered as spaces."""
data = '<u style="vi... | style | assert | variable | tests/test_core_ft_html.py | test_hidden | 46 | 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... | parent | assert | variable | tests/test_core_comm_base.py | test_new_view | TestComm | 101 | null |
joouha/euporie | from __future__ import annotations
from prompt_toolkit.formatted_text.base import to_formatted_text
from prompt_toolkit.formatted_text.utils import to_plain_text
from euporie.core.ft.html import HTML
def test_inline_block_wrapping() -> None:
"""Inline block inside inline elements should be wrapped like text."""
... | ["A B", "X", "Y C", "D"] | assert | collection | tests/test_core_ft_html.py | test_inline_block_wrapping | 129 | 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... | [call(changes)] | assert | collection | tests/test_core_comm_ipywidgets.py | test_process_data | TestIpyWidgetComm | 130 | 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()
... | 99 | assert | numeric_literal | tests/test_async_utils.py | test_run_coro_async_without_callback | 225 | 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 == ... | "d" | assert | string_literal | tests/test_core_data_structures.py | test_DiStr | 52 | 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()
... | 5 | assert | numeric_literal | tests/test_async_utils.py | test_run_coro_sync_with_given_loop | 94 | null | |
joouha/euporie | from euporie.core.layout.containers import DimensionTuple, distribute_dimensions
def test_distribute_dimensions_insufficient_space() -> None:
"""Test when there isn't enough space for minimum dimensions."""
dims = (
DimensionTuple(min=5, max=10, preferred=7),
DimensionTuple(min=6, max=12, prefe... | None | assert | none_literal | tests/test_core_layout_containers.py | test_distribute_dimensions_insufficient_space | 17 | 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... | "my_cmd" | assert | string_literal | tests/test_core_commands.py | test_add_cmd | 256 | 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... | "test" | assert | string_literal | tests/test_core_comm_ipywidgets.py | test_get_embed_state | TestIpyWidgetComm | 160 | 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 | collection | tests/test_async_utils.py | test_run_coro_async_pyodide | 212 | 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... | [["x", "a"], ["x", "b", 0], ["x", "b", 1, "c"]] | assert | collection | tests/test_core_comm_ipywidgets.py | test_separate_buffers | 79 | null | |
joouha/euporie | from __future__ import annotations
from typing import cast
from euporie.core.data_structures import (
DiBool,
DiInt,
DiStr,
WeightedDiInt,
WeightedInt,
)
def test_DiInt() -> None:
"""Test the DiInt data structure."""
d = DiInt(top=1, right=2, bottom=3, left=4)
assert d.top == | 1 | assert | numeric_literal | tests/test_core_data_structures.py | test_DiInt | 34 | 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... | "ansi" | assert | string_literal | tests/test_core_comm_ipywidgets.py | test_create_view | TestUnimplementedModel | 180 | null |
joouha/euporie | from __future__ import annotations
from unittest.mock import AsyncMock, Mock
from prompt_toolkit.completion import CompleteEvent, Completion
from prompt_toolkit.document import Document
from euporie.core.completion import KernelCompleter
from euporie.core.kernel.base import BaseKernel
async def test_kernel_complete... | [ Completion( text="print", start_position=0, display=[("", "print")], ) ] | assert | collection | tests/test_core_completions.py | test_kernel_completer_get_completions_async | 43 | null | |
joouha/euporie | from euporie.core.layout.containers import DimensionTuple, distribute_dimensions
def test_distribute_dimensions_uneven_distribution() -> None:
"""Test distribution with uneven dimension requirements."""
dims = (
DimensionTuple(min=1, max=3, preferred=2),
DimensionTuple(min=2, max=8, preferred=4... | [2, 4, 3] | assert | collection | tests/test_core_layout_containers.py | test_distribute_dimensions_uneven_distribution | 79 | 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()
... | 7 | assert | numeric_literal | tests/test_async_utils.py | test_run_coro_sync_pyodide | 125 | null | |
joouha/euporie | from __future__ import annotations
from typing import cast
from euporie.core.data_structures import (
DiBool,
DiInt,
DiStr,
WeightedDiInt,
WeightedInt,
)
def test_DiInt() -> None:
"""Test the DiInt data structure."""
d = DiInt(top=1, right=2, bottom=3, left=4)
assert d.top == 1
as... | 3 | assert | numeric_literal | tests/test_core_data_structures.py | test_DiInt | 36 | null | |
joouha/euporie | from __future__ import annotations
from unittest.mock import AsyncMock, Mock
from prompt_toolkit.completion import CompleteEvent, Completion
from prompt_toolkit.document import Document
from euporie.core.completion import KernelCompleter
from euporie.core.kernel.base import BaseKernel
def test_kernel_completer_init... | kernel | assert | variable | tests/test_core_completions.py | test_kernel_completer_init | 18 | 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_truncate() -> None:
"""T... | 12 | assert | numeric_literal | tests/test_core_ft_utils.py | test_truncate | 121 | null | |
joouha/euporie | from __future__ import annotations
from io import BytesIO
from pathlib import Path
from typing import TYPE_CHECKING
from unittest.mock import MagicMock, patch
import magic
from fsspec.implementations.http import HTTPFileSystem
from upath import UPath
from upath.implementations.http import HTTPPath
from euporie.core.... | "png" | assert | string_literal | tests/test_core_convert_mime.py | test_get_format | 87 | 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 == ... | "e" | assert | string_literal | tests/test_core_data_structures.py | test_DiStr | 55 | 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 ... | test_colors["red"] | assert | complex_expr | tests/test_core_style.py | test_color_palette_access_color | 37 | 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
def test_si... | None | assert | none_literal | tests/test_core_convert_datum.py | test_sized_datum | 105 | null | |
joouha/euporie | from __future__ import annotations
from pygments import highlight
from pygments.formatters.terminal256 import TerminalTrueColorFormatter
from pygments.lexers import PythonLexer
from euporie.core.pygments import ArgparseLexer, EuporiePygmentsStyle
def test_argparse_lexer() -> None:
"""Argparse lexer output is as ... | expected_output | assert | variable | tests/test_core_pygments.py | test_argparse_lexer | 33 | 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... | 1 | assert | numeric_literal | tests/test_core_comm_base.py | test_update | TestCommView | 62 | 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... | (256, 128) | assert | collection | tests/test_core_convert_datum.py | test_pixel_size_async | 69 | 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... | WIDGET_MODELS | assert | variable | tests/test_core_comm_ipywidgets.py | test_init_subclass | TestIpyWidgetComm | 97 | 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
def test_si... | Datum._sizes | assert | complex_expr | tests/test_core_convert_datum.py | test_sized_datum | 101 | 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, ... | 6 | assert | numeric_literal | tests/test_core_utils.py | test_ChainedList | 14 | 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... | 1 | assert | numeric_literal | tests/test_core_comm_ipywidgets.py | test_get_embed_state | TestIpyWidgetComm | 164 | 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... | "(Conversion Error)" | assert | string_literal | tests/test_core_convert_datum.py | test_convert | 44 | 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_dict_merge() -> None:
"""Test dict_merge."""
target_dict = {"a": 1, "b"... | {"a": 1, "b": {"c": 4, "d": 3}, "e": [1, 2, 3, 4], "f": 5} | assert | collection | tests/test_core_utils.py | test_dict_merge | 25 | 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_tabs() -> None:
"""Tabs are converted to spaces."""
value = ANSI("1\t23\t234\t5", tab_size=3)
assert to_formatted_text(value) == | [ ("", "1"), ("", " "), ("", " "), ("", "2"), ("", "3"), ("", " "), ("", "2"), ("", "3"), ("", "4"), ("", " "), ("", " "), ("", " "), ("", "5"), ] | assert | collection | tests/test_core_ft_ansi.py | test_ansi_tabs | 13 | 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... | "1234" | assert | string_literal | tests/test_core_comm_base.py | test_init | TestComm | 85 | null |
joouha/euporie | from __future__ import annotations
from typing import cast
from euporie.core.data_structures import (
DiBool,
DiInt,
DiStr,
WeightedDiInt,
WeightedInt,
)
def test_DiBool() -> None:
"""Test the DiBool data structure."""
d = DiBool(top=True, right=True, bottom=False, left=False)
assert... | True | assert | bool_literal | tests/test_core_data_structures.py | test_DiBool | 19 | 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... | ([], 0) | assert | collection | tests/test_core_ft_utils.py | test_concat | 277 | 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()
... | fut | assert | variable | tests/test_async_utils.py | test_run_coro_async_previous_tasks_tracking | 191 | 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... | [("", "Hello")] | assert | collection | tests/test_core_convert_datum.py | test_convert | 29 | null | |
joouha/euporie | from __future__ import annotations
from prompt_toolkit.formatted_text.base import to_formatted_text
from prompt_toolkit.formatted_text.utils import to_plain_text
from euporie.core.ft.html import HTML
def test_inline_whitespace() -> None:
"""Whitespace between inline elements is correctly collapsed."""
data =... | expected | assert | variable | tests/test_core_ft_html.py | test_inline_whitespace | 16 | 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... | "1.0.0" | assert | string_literal | tests/test_core_comm_ipywidgets.py | test_get_embed_state | TestIpyWidgetComm | 162 | null |
marshmallow-code/marshmallow | import typing
import pytest
from marshmallow import (
Schema,
fields,
post_dump,
post_load,
pre_dump,
pre_load,
validates,
validates_schema,
)
from marshmallow.exceptions import ValidationError
from marshmallow.experimental.context import Context
from tests.base import Blog, User
clas... | "value" | assert | string_literal | tests/test_context.py | test_function_field_handles_bound_serializer | TestContext | 93 | null |
marshmallow-code/marshmallow | from typing import NamedTuple
from marshmallow import missing
from marshmallow.error_store import ErrorStore, merge_errors
class TestMergeErrors:
def test_merging_none_and_string(self):
assert merge_errors(None, "error1") == | "error1" | assert | string_literal | tests/test_error_store.py | test_merging_none_and_string | TestMergeErrors | 18 | null |
marshmallow-code/marshmallow | from __future__ import annotations
import datetime as dt
from copy import copy, deepcopy
from typing import NamedTuple
import pytest
from marshmallow import Schema, fields, utils
def test_set_value():
d: dict[str, int | dict] = {}
utils.set_value(d, "foo", 42)
assert d == {"foo": 42}
d = {}
uti... | ValueError) | pytest.raises | variable | tests/test_utils.py | test_set_value | 96 | null | |
marshmallow-code/marshmallow | import datetime as dt
from marshmallow import EXCLUDE, Schema, fields
class TestIncludeOption:
def test_included_fields_ordered_after_declared_fields(self):
class AddFieldsOrdered(Schema):
name = fields.Str()
email = fields.Str()
class Meta:
include = ... | expected_fields | assert | variable | tests/test_options.py | test_included_fields_ordered_after_declared_fields | TestIncludeOption | 137 | null |
marshmallow-code/marshmallow | import datetime as dt
from marshmallow import EXCLUDE, Schema, fields
class TestManyOption:
def test_many_by_default(self):
test = self.ManySchema()
assert test.load([{"foo": "bar"}]) == | [{"foo": "bar"}] | assert | collection | tests/test_options.py | test_many_by_default | TestManyOption | 161 | null |
marshmallow-code/marshmallow | from __future__ import annotations
import datetime as dt
from copy import copy, deepcopy
from typing import NamedTuple
import pytest
from marshmallow import Schema, fields, utils
def test_get_value_from_namedtuple_with_default():
p = PointNT(x=42, y=None)
# Default is only returned if key is not found
a... | None | assert | none_literal | tests/test_utils.py | test_get_value_from_namedtuple_with_default | 47 | null | |
marshmallow-code/marshmallow | import typing
import pytest
from marshmallow import (
Schema,
fields,
post_dump,
post_load,
pre_dump,
pre_load,
validates,
validates_schema,
)
from marshmallow.exceptions import ValidationError
from marshmallow.experimental.context import Context
from tests.base import Blog, User
clas... | False | assert | bool_literal | tests/test_context.py | test_context_method | TestContext | 64 | null |
marshmallow-code/marshmallow | import datetime as dt
import decimal
import ipaddress
import math
import uuid
from unittest.mock import patch
import pytest
from marshmallow import (
EXCLUDE,
INCLUDE,
RAISE,
Schema,
fields,
missing,
validate,
)
from marshmallow.exceptions import ValidationError
from tests.base import (
... | 2 | assert | numeric_literal | tests/test_deserialization.py | test_list_field_deserialize_multiple_invalid_items | TestFieldDeserialization | 1,339 | null |
marshmallow-code/marshmallow | import pytest
from marshmallow import (
EXCLUDE,
INCLUDE,
RAISE,
Schema,
ValidationError,
fields,
post_dump,
post_load,
pre_dump,
pre_load,
validate,
validates,
validates_schema,
)
from tests.base import predicate
class TestPassOriginal:
def test_pass_original_s... | 24 | assert | numeric_literal | tests/test_decorators.py | test_pass_original_single | TestPassOriginal | 153 | null |
marshmallow-code/marshmallow | import datetime as dt
import decimal
import ipaddress
import itertools
import math
import uuid
from collections import OrderedDict
from typing import NamedTuple
import pytest
from marshmallow import Schema, fields
from marshmallow import missing as missing_
from tests.base import ALL_FIELDS, DateEnum, GenderEnum, Hai... | 3 | assert | numeric_literal | tests/test_serialization.py | test_list_field_work_with_set | TestFieldSerialization | 841 | null |
marshmallow-code/marshmallow | import datetime as dt
import decimal
import ipaddress
import itertools
import math
import uuid
from collections import OrderedDict
from typing import NamedTuple
import pytest
from marshmallow import Schema, fields
from marshmallow import missing as missing_
from tests.base import ALL_FIELDS, DateEnum, GenderEnum, Hai... | 42 | assert | numeric_literal | tests/test_serialization.py | test_integer_field | TestFieldSerialization | 100 | null |
marshmallow-code/marshmallow | from __future__ import annotations
import datetime as dt
from copy import copy, deepcopy
from typing import NamedTuple
import pytest
from marshmallow import Schema, fields, utils
@pytest.mark.parametrize(
("value", "expected"),
[
(1676386740, dt.datetime(2023, 2, 14, 14, 59, 00)),
(167638674... | expected | assert | variable | tests/test_utils.py | test_from_timestamp | 116 | null | |
marshmallow-code/marshmallow | import re
import pytest
from marshmallow import ValidationError, validate
def test_range_min():
assert validate.Range(1, 2)(1) == | 1 | assert | numeric_literal | tests/test_validate.py | test_range_min | 356 | null | |
marshmallow-code/marshmallow | from __future__ import annotations
import datetime as dt
from copy import copy, deepcopy
from typing import NamedTuple
import pytest
from marshmallow import Schema, fields, utils
def test_get_value():
lst = [1, 2, 3]
assert utils.get_value(lst, 1) == | 2 | assert | numeric_literal | tests/test_utils.py | test_get_value | 74 | null | |
marshmallow-code/marshmallow | import pytest
from marshmallow.exceptions import ValidationError
class TestValidationError:
def test_messages_dict_type_error_on_badval(self):
err = ValidationError("foo")
with pytest.raises( | TypeError) | pytest.raises | variable | tests/test_exceptions.py | test_messages_dict_type_error_on_badval | TestValidationError | 38 | null |
marshmallow-code/marshmallow | import datetime as dt
import decimal
import ipaddress
import itertools
import math
import uuid
from collections import OrderedDict
from typing import NamedTuple
import pytest
from marshmallow import Schema, fields
from marshmallow import missing as missing_
from tests.base import ALL_FIELDS, DateEnum, GenderEnum, Hai... | 4 | assert | numeric_literal | tests/test_serialization.py | test_serializing_named_tuple | 961 | null | |
marshmallow-code/marshmallow | import datetime as dt
from marshmallow import EXCLUDE, Schema, fields
class TestIncludeOption:
def test_fields_are_added(self):
s = self.AddFieldsSchema()
in_data = {"name": "Steve", "from": "Oskosh"}
result = s.load({"name": "Steve", "from": "Oskosh"})
assert result == | in_data | assert | variable | tests/test_options.py | test_fields_are_added | TestIncludeOption | 113 | null |
marshmallow-code/marshmallow | import pytest
from marshmallow import (
EXCLUDE,
INCLUDE,
RAISE,
Schema,
ValidationError,
fields,
missing,
)
from marshmallow.exceptions import StringNotCollectionError
from marshmallow.orderedset import OrderedSet
from tests.base import ALL_FIELDS
class TestParentAndName:
def schema(... | None | assert | none_literal | tests/test_fields.py | test_unbound_field_root_returns_none | TestParentAndName | 114 | null |
marshmallow-code/marshmallow | from __future__ import annotations
import datetime as dt
from copy import copy, deepcopy
from typing import NamedTuple
import pytest
from marshmallow import Schema, fields, utils
@pytest.mark.parametrize(
("value", "expected"),
[
(1676386740, dt.datetime(2023, 2, 14, 14, 59, 00)),
(167638674... | dt.datetime | assert | complex_expr | tests/test_utils.py | test_from_timestamp | 115 | null | |
marshmallow-code/marshmallow | import pytest
from marshmallow import Schema, class_registry, fields
from marshmallow.exceptions import RegistryError
def test_serializer_has_class_registry():
class MySchema(Schema):
pass
class MySubSchema(Schema):
pass
assert "MySchema" in | class_registry._registry | assert | complex_expr | tests/test_registry.py | test_serializer_has_class_registry | 14 | null | |
marshmallow-code/marshmallow | from __future__ import annotations
import datetime as dt
from copy import copy, deepcopy
from typing import NamedTuple
import pytest
from marshmallow import Schema, fields, utils
def test_get_value_for_nested_object():
tri = Triangle(p1=PointClass(1, 2), p2=PointNT(3, 4), p3={"x": 5, "y": 6})
assert utils.... | 1 | assert | numeric_literal | tests/test_utils.py | test_get_value_for_nested_object | 60 | null | |
marshmallow-code/marshmallow | import datetime as dt
from marshmallow import EXCLUDE, Schema, fields
class TestManyOption:
def test_explicit_single(self):
test = self.ManySchema(many=False)
assert test.load({"foo": "bar"}) == | {"foo": "bar"} | assert | collection | tests/test_options.py | test_explicit_single | TestManyOption | 165 | null |
marshmallow-code/marshmallow | import pytest
from marshmallow.exceptions import ValidationError
class TestValidationError:
def test_can_pass_list_of_messages(self):
err = ValidationError(["foo", "bar"])
assert err.messages == | ["foo", "bar"] | assert | collection | tests/test_exceptions.py | test_can_pass_list_of_messages | TestValidationError | 13 | null |
marshmallow-code/marshmallow | import datetime as dt
import decimal
import ipaddress
import math
import uuid
from unittest.mock import patch
import pytest
from marshmallow import (
EXCLUDE,
INCLUDE,
RAISE,
Schema,
fields,
missing,
validate,
)
from marshmallow.exceptions import ValidationError
from tests.base import (
... | 0 | assert | numeric_literal | tests/test_deserialization.py | test_timedelta_field_deserialization | TestFieldDeserialization | 723 | null |
marshmallow-code/marshmallow | import pytest
from marshmallow import (
EXCLUDE,
INCLUDE,
RAISE,
Schema,
ValidationError,
fields,
missing,
)
from marshmallow.exceptions import StringNotCollectionError
from marshmallow.orderedset import OrderedSet
from tests.base import ALL_FIELDS
@pytest.mark.parametrize(
("alias", "... | field | assert | variable | tests/test_fields.py | test_field_aliases | 27 | null | |
marshmallow-code/marshmallow | import pytest
from marshmallow import (
EXCLUDE,
INCLUDE,
RAISE,
Schema,
ValidationError,
fields,
post_dump,
post_load,
pre_dump,
pre_load,
validate,
validates,
validates_schema,
)
from tests.base import predicate
def test_decorator_error_handling():
class Examp... | 1 | assert | numeric_literal | tests/test_decorators.py | test_decorator_error_handling | 772 | null | |
marshmallow-code/marshmallow | from __future__ import annotations
import datetime as dt
from copy import copy, deepcopy
from typing import NamedTuple
import pytest
from marshmallow import Schema, fields, utils
def test_is_collection():
assert utils.is_collection([1, "foo", {}]) is True
assert utils.is_collection(("foo", 2.3)) is True
... | False | assert | bool_literal | tests/test_utils.py | test_is_collection | 103 | null | |
marshmallow-code/marshmallow | import pytest
from marshmallow.exceptions import ValidationError
class TestValidationError:
def test_messages_dict_type_error_on_badval(self):
err = ValidationError("foo")
with pytest.raises(TypeError) as excinfo:
err.messages_dict # noqa: B018
assert "cannot access 'message... | str( excinfo.value ) | assert | func_call | tests/test_exceptions.py | test_messages_dict_type_error_on_badval | TestValidationError | 40 | null |
marshmallow-code/marshmallow | from __future__ import annotations
import datetime as dt
from copy import copy, deepcopy
from typing import NamedTuple
import pytest
from marshmallow import Schema, fields, utils
def test_get_value_from_namedtuple_with_default():
p = PointNT(x=42, y=None)
# Default is only returned if key is not found
... | 123 | assert | numeric_literal | tests/test_utils.py | test_get_value_from_namedtuple_with_default | 45 | null | |
marshmallow-code/marshmallow | from __future__ import annotations
import datetime as dt
from copy import copy, deepcopy
from typing import NamedTuple
import pytest
from marshmallow import Schema, fields, utils
def test_set_value():
d: dict[str, int | dict] = {}
utils.set_value(d, "foo", 42)
assert d == | {"foo": 42} | assert | collection | tests/test_utils.py | test_set_value | 85 | null | |
marshmallow-code/marshmallow | from __future__ import annotations
import datetime as dt
from copy import copy, deepcopy
from typing import NamedTuple
import pytest
from marshmallow import Schema, fields, utils
def test_get_value_for_nested_object():
tri = Triangle(p1=PointClass(1, 2), p2=PointNT(3, 4), p3={"x": 5, "y": 6})
assert utils.g... | 3 | assert | numeric_literal | tests/test_utils.py | test_get_value_for_nested_object | 61 | null | |
marshmallow-code/marshmallow | import typing
import pytest
from marshmallow import (
Schema,
fields,
post_dump,
post_load,
pre_dump,
pre_load,
validates,
validates_schema,
)
from marshmallow.exceptions import ValidationError
from marshmallow.experimental.context import Context
from tests.base import Blog, User
clas... | "MONTYBAR" | assert | string_literal | tests/test_context.py | test_function_field_passed_serialize_with_context | TestContext | 176 | null |
marshmallow-code/marshmallow | from __future__ import annotations
import datetime as dt
from copy import copy, deepcopy
from typing import NamedTuple
import pytest
from marshmallow import Schema, fields, utils
def test_missing_singleton_copy():
assert copy(utils.missing) is | utils.missing | assert | complex_expr | tests/test_utils.py | test_missing_singleton_copy | 13 | null | |
marshmallow-code/marshmallow | import pytest
from marshmallow import Schema, class_registry, fields
from marshmallow.exceptions import RegistryError
def test_two_way_nesting():
a_obj = A(1)
b_obj = B(2, a=a_obj)
a_obj.b = b_obj
a_serialized = ASchema().dump(a_obj)
b_serialized = BSchema().dump(b_obj)
assert a_serialized["... | b_obj.id | assert | complex_expr | tests/test_registry.py | test_two_way_nesting | 163 | null | |
marshmallow-code/marshmallow | import datetime as dt
import functools
import typing
import uuid
from enum import Enum, IntEnum
from zoneinfo import ZoneInfo
import simplejson
from marshmallow import Schema, fields, missing, post_load, validate
from marshmallow.exceptions import ValidationError
central = ZoneInfo("America/Chicago")
def assert_dat... | t2.minute | assert | complex_expr | tests/base.py | assert_time_equal | 74 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.