repo_id
stringclasses
400 values
commit_sha
stringclasses
400 values
commit_index
int32
0
951
in_repo_split
stringclasses
1 value
cross_repo_split
stringclasses
1 value
test_file
stringlengths
7
121
test_function
stringlengths
1
108
assertion_type
stringclasses
32 values
difficulty
stringclasses
8 values
context_lines
int32
3
600
prefix
large_stringlengths
44
113k
target
large_stringlengths
1
498
anchor_sha
stringclasses
400 values
anchor_index
int32
0
951
qna_source
stringclasses
1 value
Lancetnik/Propan
49536cddc2dcf5216925fcaa750671623a12d0f2
66
train
train
tests/brokers/redis/test_test_client.py
test_pattern_consume
assert
numeric_literal
20
import pytest from propan import RedisBroker from propan.test.redis import build_message from tests.brokers.base.testclient import BrokerTestclientTestcase class TestKafkaTestclient(BrokerTestclientTestcase): build_message = staticmethod(build_message) @pytest.mark.asyncio async def test_pattern_consume(...
1
49536cddc2dcf5216925fcaa750671623a12d0f2
66
v2_extractor_at_anchor
Lancetnik/Propan
49536cddc2dcf5216925fcaa750671623a12d0f2
66
train
train
tests/cli/test_app.py
call2
assert
numeric_literal
18
import logging import os import signal from unittest.mock import Mock, patch import anyio import pytest from propan import PropanApp from propan.brokers.rabbit import RabbitBroker from propan.log import logger from propan.utils import Context from tests.tools.marks import needs_py38 def call2(): mock.cal...
1
49536cddc2dcf5216925fcaa750671623a12d0f2
66
v2_extractor_at_anchor
Lancetnik/Propan
49536cddc2dcf5216925fcaa750671623a12d0f2
66
train
train
tests/cli/test_app.py
test_init
assert
variable
18
import logging import os import signal from unittest.mock import Mock, patch import anyio import pytest from propan import PropanApp from propan.brokers.rabbit import RabbitBroker from propan.log import logger from propan.utils import Context from tests.tools.marks import needs_py38 def test_init(app: PropanApp, con...
app
49536cddc2dcf5216925fcaa750671623a12d0f2
66
v2_extractor_at_anchor
Lancetnik/Propan
49536cddc2dcf5216925fcaa750671623a12d0f2
66
train
train
tests/cli/test_app.py
test_init_without_broker
assert
none_literal
17
import logging import os import signal from unittest.mock import Mock, patch import anyio import pytest from propan import PropanApp from propan.brokers.rabbit import RabbitBroker from propan.log import logger from propan.utils import Context from tests.tools.marks import needs_py38 def test_init_without_broker(app_...
None
49536cddc2dcf5216925fcaa750671623a12d0f2
66
v2_extractor_at_anchor
Lancetnik/Propan
49536cddc2dcf5216925fcaa750671623a12d0f2
66
train
train
tests/cli/test_app.py
test_init
assert
variable
17
import logging import os import signal from unittest.mock import Mock, patch import anyio import pytest from propan import PropanApp from propan.brokers.rabbit import RabbitBroker from propan.log import logger from propan.utils import Context from tests.tools.marks import needs_py38 def test_init(app: PropanApp, con...
broker
49536cddc2dcf5216925fcaa750671623a12d0f2
66
v2_extractor_at_anchor
Lancetnik/Propan
49536cddc2dcf5216925fcaa750671623a12d0f2
66
train
train
tests/cli/test_app.py
test_init
assert
variable
19
import logging import os import signal from unittest.mock import Mock, patch import anyio import pytest from propan import PropanApp from propan.brokers.rabbit import RabbitBroker from propan.log import logger from propan.utils import Context from tests.tools.marks import needs_py38 def test_init(app: PropanApp, con...
logger
49536cddc2dcf5216925fcaa750671623a12d0f2
66
v2_extractor_at_anchor
Lancetnik/Propan
49536cddc2dcf5216925fcaa750671623a12d0f2
66
train
train
tests/cli/test_doc.py
test_gen_rabbit_docs
assert
numeric_literal
14
from pathlib import Path from unittest.mock import Mock import uvicorn import yaml from typer.testing import CliRunner from propan.cli.main import cli def test_gen_rabbit_docs(runner: CliRunner, rabbit_async_project: Path): app_path = f'{rabbit_async_project / "app" / "serve"}:app' r = runner.invoke(cli, ["d...
0
49536cddc2dcf5216925fcaa750671623a12d0f2
66
v2_extractor_at_anchor
Lancetnik/Propan
49536cddc2dcf5216925fcaa750671623a12d0f2
66
train
train
tests/cli/test_doc.py
test_gen_wrong_path
assert
numeric_literal
14
from pathlib import Path from unittest.mock import Mock import uvicorn import yaml from typer.testing import CliRunner from propan.cli.main import cli def test_gen_wrong_path(runner: CliRunner, rabbit_async_project: Path): app_path = f'{rabbit_async_project / "app" / "serve"}:app1' r = runner.invoke(cli, ["d...
2
49536cddc2dcf5216925fcaa750671623a12d0f2
66
v2_extractor_at_anchor
Lancetnik/Propan
49536cddc2dcf5216925fcaa750671623a12d0f2
66
train
train
tests/cli/test_doc.py
test_gen_wrong_path
assert
complex_expr
15
from pathlib import Path from unittest.mock import Mock import uvicorn import yaml from typer.testing import CliRunner from propan.cli.main import cli def test_gen_wrong_path(runner: CliRunner, rabbit_async_project: Path): app_path = f'{rabbit_async_project / "app" / "serve"}:app1' r = runner.invoke(cli, ["d...
r.stdout
49536cddc2dcf5216925fcaa750671623a12d0f2
66
v2_extractor_at_anchor
Lancetnik/Propan
49536cddc2dcf5216925fcaa750671623a12d0f2
66
train
train
tests/cli/test_run.py
test_run_rabbit_correct
assert
numeric_literal
30
from pathlib import Path from unittest.mock import Mock import pytest from typer.testing import CliRunner from propan import PropanApp from propan.cli import cli @pytest.mark.rabbit @pytest.mark.run def test_run_rabbit_correct( runner: CliRunner, rabbit_async_project: Path, monkeypatch, mock: Mock, )...
0
49536cddc2dcf5216925fcaa750671623a12d0f2
66
v2_extractor_at_anchor
Lancetnik/Propan
49536cddc2dcf5216925fcaa750671623a12d0f2
66
train
train
tests/cli/test_version.py
test_version
assert
numeric_literal
8
import platform from propan.cli.main import cli def test_version(runner, version): result = runner.invoke(cli, ["--version"]) assert result.exit_code ==
0
49536cddc2dcf5216925fcaa750671623a12d0f2
66
v2_extractor_at_anchor
Lancetnik/Propan
49536cddc2dcf5216925fcaa750671623a12d0f2
66
train
train
tests/cli/test_version.py
test_version
assert
complex_expr
9
import platform from propan.cli.main import cli def test_version(runner, version): result = runner.invoke(cli, ["--version"]) assert result.exit_code == 0 assert version in
result.stdout
49536cddc2dcf5216925fcaa750671623a12d0f2
66
v2_extractor_at_anchor
Lancetnik/Propan
49536cddc2dcf5216925fcaa750671623a12d0f2
66
train
train
tests/cli/utils/test_imports.py
test_get_app_path
assert
variable
17
from pathlib import Path import pytest from propan.cli.utils.imports import get_app_path, import_object @pytest.mark.parametrize( "test_input,exp_module,exp_app", ( ("module:app", "module", "app"), ("module.module.module:app", "module/module/module", "app"), ), ) def test_get_app_path(tes...
exp_app
49536cddc2dcf5216925fcaa750671623a12d0f2
66
v2_extractor_at_anchor
Lancetnik/Propan
49536cddc2dcf5216925fcaa750671623a12d0f2
66
train
train
tests/cli/utils/test_imports.py
test_get_app_path_wrong
pytest.raises
variable
9
from pathlib import Path import pytest from propan.cli.utils.imports import get_app_path, import_object def test_get_app_path_wrong(): with pytest.raises(
ValueError)
49536cddc2dcf5216925fcaa750671623a12d0f2
66
v2_extractor_at_anchor
Lancetnik/Propan
49536cddc2dcf5216925fcaa750671623a12d0f2
66
train
train
tests/cli/utils/test_imports.py
test_import_wrong
assert
func_call
13
from pathlib import Path import pytest from propan.cli.utils.imports import get_app_path, import_object def test_import_wrong(): dir, app = get_app_path("tests:test_object") with pytest.raises(FileNotFoundError) as excinfo: import_object(dir, app) assert f"{dir}.py" in
str(excinfo.value)
49536cddc2dcf5216925fcaa750671623a12d0f2
66
v2_extractor_at_anchor
Lancetnik/Propan
49536cddc2dcf5216925fcaa750671623a12d0f2
66
train
train
tests/cli/utils/test_imports.py
test_import_wrong
pytest.raises
variable
10
from pathlib import Path import pytest from propan.cli.utils.imports import get_app_path, import_object def test_import_wrong(): dir, app = get_app_path("tests:test_object") with pytest.raises(
FileNotFoundError)
49536cddc2dcf5216925fcaa750671623a12d0f2
66
v2_extractor_at_anchor
Lancetnik/Propan
49536cddc2dcf5216925fcaa750671623a12d0f2
66
train
train
tests/cli/utils/test_imports.py
test_get_app_path
assert
func_call
18
from pathlib import Path import pytest from propan.cli.utils.imports import get_app_path, import_object @pytest.mark.parametrize( "test_input,exp_module,exp_app", ( ("module:app", "module", "app"), ("module.module.module:app", "module/module/module", "app"), ), ) def test_get_app_path(tes...
Path.cwd() / exp_module
49536cddc2dcf5216925fcaa750671623a12d0f2
66
v2_extractor_at_anchor
Lancetnik/Propan
49536cddc2dcf5216925fcaa750671623a12d0f2
66
train
train
tests/cli/utils/test_logs.py
test_set_default
assert
complex_expr
14
import logging from itertools import zip_longest import pytest from propan import PropanApp, RabbitBroker from propan.cli.utils.logs import LogLevels, get_log_level, set_log_level def test_set_default(): app = PropanApp() level = "wrong_level" set_log_level(get_log_level(level), app) assert app.logg...
logging.INFO
49536cddc2dcf5216925fcaa750671623a12d0f2
66
v2_extractor_at_anchor
Lancetnik/Propan
49536cddc2dcf5216925fcaa750671623a12d0f2
66
train
train
tests/cli/utils/test_logs.py
test_set_level
assert
complex_expr
28
import logging from itertools import zip_longest import pytest from propan import PropanApp, RabbitBroker from propan.cli.utils.logs import LogLevels, get_log_level, set_log_level @pytest.mark.parametrize( "level,broker", tuple( zip_longest( ( logging.ERROR, ...
app.broker.logger.level
49536cddc2dcf5216925fcaa750671623a12d0f2
66
v2_extractor_at_anchor
Lancetnik/Propan
49536cddc2dcf5216925fcaa750671623a12d0f2
66
train
train
tests/cli/utils/test_parser.py
test_custom_argument_parsing
assert
variable
41
from typing import Tuple import pytest from propan.cli.utils.parser import parse_cli_args APPLICATION = "module:app" ARG1 = ( "--k", "1", ) ARG2 = ( "-k2", "1", ) ARG3 = ("--k3",) ARG4 = ("--no-k4",) ARG5 = ( "--k5", "1", "1", ) ARG6 = ("--some-key",) @pytest.mark.parametrize( "args...
APPLICATION
49536cddc2dcf5216925fcaa750671623a12d0f2
66
v2_extractor_at_anchor
Lancetnik/Propan
49536cddc2dcf5216925fcaa750671623a12d0f2
66
train
train
tests/cli/utils/test_parser.py
test_custom_argument_parsing
assert
collection
42
from typing import Tuple import pytest from propan.cli.utils.parser import parse_cli_args APPLICATION = "module:app" ARG1 = ( "--k", "1", ) ARG2 = ( "-k2", "1", ) ARG3 = ("--k3",) ARG4 = ("--no-k4",) ARG5 = ( "--k5", "1", "1", ) ARG6 = ("--some-key",) @pytest.mark.parametrize( "args...
{ "k": "1", "k2": "1", "k3": True, "k4": False, "k5": ["1", "1"], "some_key": True, }
49536cddc2dcf5216925fcaa750671623a12d0f2
66
v2_extractor_at_anchor
Lancetnik/Propan
49536cddc2dcf5216925fcaa750671623a12d0f2
66
train
train
tests/fastapi/case.py
test
assert
numeric_literal
74
from typing import Callable, Type, TypeVar from unittest.mock import Mock from uuid import uuid4 import pytest from fastapi import APIRouter, Depends, FastAPI, Header from fastapi.testclient import TestClient from propan.types import AnyCallable Broker = TypeVar("Broker") class FastAPITestcase: router_class: Ty...
4
49536cddc2dcf5216925fcaa750671623a12d0f2
66
v2_extractor_at_anchor
Lancetnik/Propan
49536cddc2dcf5216925fcaa750671623a12d0f2
66
train
train
tests/fastapi/case.py
test
assert
string_literal
55
from typing import Callable, Type, TypeVar from unittest.mock import Mock from uuid import uuid4 import pytest from fastapi import APIRouter, Depends, FastAPI, Header from fastapi.testclient import TestClient from propan.types import AnyCallable Broker = TypeVar("Broker") class FastAPITestcase: router_class: Ty...
"1"
49536cddc2dcf5216925fcaa750671623a12d0f2
66
v2_extractor_at_anchor
Lancetnik/Propan
49536cddc2dcf5216925fcaa750671623a12d0f2
66
train
train
tests/fastapi/case.py
test
assert
string_literal
60
from typing import Callable, Type, TypeVar from unittest.mock import Mock from uuid import uuid4 import pytest from fastapi import APIRouter, Depends, FastAPI, Header from fastapi.testclient import TestClient from propan.types import AnyCallable Broker = TypeVar("Broker") class FastAPITestcase: router_class: Ty...
"2"
49536cddc2dcf5216925fcaa750671623a12d0f2
66
v2_extractor_at_anchor
Lancetnik/Propan
49536cddc2dcf5216925fcaa750671623a12d0f2
66
train
train
tests/fastapi/case.py
test
assert
string_literal
71
from typing import Callable, Type, TypeVar from unittest.mock import Mock from uuid import uuid4 import pytest from fastapi import APIRouter, Depends, FastAPI, Header from fastapi.testclient import TestClient from propan.types import AnyCallable Broker = TypeVar("Broker") class FastAPITestcase: router_class: Ty...
"3"
49536cddc2dcf5216925fcaa750671623a12d0f2
66
v2_extractor_at_anchor
Lancetnik/Propan
49536cddc2dcf5216925fcaa750671623a12d0f2
66
train
train
tests/fastapi/case.py
test
assert
complex_expr
50
from typing import Callable, Type, TypeVar from unittest.mock import Mock from uuid import uuid4 import pytest from fastapi import APIRouter, Depends, FastAPI, Header from fastapi.testclient import TestClient from propan.types import AnyCallable Broker = TypeVar("Broker") class FastAPITestcase: router_class: Ty...
router.broker
49536cddc2dcf5216925fcaa750671623a12d0f2
66
v2_extractor_at_anchor
Lancetnik/Propan
49536cddc2dcf5216925fcaa750671623a12d0f2
66
train
train
tests/fastapi/test_base.py
test_get_schema_yaml
assert
numeric_literal
28
from contextlib import asynccontextmanager from typing import Any from unittest.mock import Mock import pytest from fastapi import Depends, FastAPI from fastapi.testclient import TestClient from propan._compat import ResponseValidationError from propan.fastapi import KafkaRouter from propan.test import TestKafkaBroke...
200
49536cddc2dcf5216925fcaa750671623a12d0f2
66
v2_extractor_at_anchor
Lancetnik/Propan
49536cddc2dcf5216925fcaa750671623a12d0f2
66
train
train
tests/fastapi/test_base.py
test_not_generate_schema
assert
numeric_literal
30
from contextlib import asynccontextmanager from typing import Any from unittest.mock import Mock import pytest from fastapi import Depends, FastAPI from fastapi.testclient import TestClient from propan._compat import ResponseValidationError from propan.fastapi import KafkaRouter from propan.test import TestKafkaBroke...
404
49536cddc2dcf5216925fcaa750671623a12d0f2
66
v2_extractor_at_anchor
Lancetnik/Propan
49536cddc2dcf5216925fcaa750671623a12d0f2
66
train
train
tests/fastapi/test_base.py
test_nested_lifespan
assert
bool_literal
42
from contextlib import asynccontextmanager from typing import Any from unittest.mock import Mock import pytest from fastapi import Depends, FastAPI from fastapi.testclient import TestClient from propan._compat import ResponseValidationError from propan.fastapi import KafkaRouter from propan.test import TestKafkaBroke...
True
49536cddc2dcf5216925fcaa750671623a12d0f2
66
v2_extractor_at_anchor
Lancetnik/Propan
49536cddc2dcf5216925fcaa750671623a12d0f2
66
train
train
tests/fastapi/test_base.py
test_nested_lifespan
assert
complex_expr
43
from contextlib import asynccontextmanager from typing import Any from unittest.mock import Mock import pytest from fastapi import Depends, FastAPI from fastapi.testclient import TestClient from propan._compat import ResponseValidationError from propan.fastapi import KafkaRouter from propan.test import TestKafkaBroke...
router.broker
49536cddc2dcf5216925fcaa750671623a12d0f2
66
v2_extractor_at_anchor
Lancetnik/Propan
49536cddc2dcf5216925fcaa750671623a12d0f2
66
train
train
tests/fastapi/test_base.py
test_invalid_request
pytest.raises
variable
29
from contextlib import asynccontextmanager from typing import Any from unittest.mock import Mock import pytest from fastapi import Depends, FastAPI from fastapi.testclient import TestClient from propan._compat import ResponseValidationError from propan.fastapi import KafkaRouter from propan.test import TestKafkaBroke...
ResponseValidationError)
49536cddc2dcf5216925fcaa750671623a12d0f2
66
v2_extractor_at_anchor
Lancetnik/Propan
49536cddc2dcf5216925fcaa750671623a12d0f2
66
train
train
tests/fastapi/test_base.py
test_get_schema_json
assert
collection
46
from contextlib import asynccontextmanager from typing import Any from unittest.mock import Mock import pytest from fastapi import Depends, FastAPI from fastapi.testclient import TestClient from propan._compat import ResponseValidationError from propan.fastapi import KafkaRouter from propan.test import TestKafkaBroke...
{"a", "b", "c", "m", "k"}
49536cddc2dcf5216925fcaa750671623a12d0f2
66
v2_extractor_at_anchor
Lancetnik/Propan
49536cddc2dcf5216925fcaa750671623a12d0f2
66
train
train
tests/utils/context/test_depends.py
test_sync_with_async_depends
pytest.raises
variable
14
import pytest from propan.utils import Depends, apply_types def sync_dep(key): return key async def async_dep(key): return key @pytest.mark.asyncio async def test_sync_with_async_depends(): with pytest.raises(
AssertionError)
49536cddc2dcf5216925fcaa750671623a12d0f2
66
v2_extractor_at_anchor
Lancetnik/Propan
49536cddc2dcf5216925fcaa750671623a12d0f2
66
train
train
tests/utils/context/test_main.py
test_context_getattr
assert
variable
11
import pytest from pydantic import ValidationError from propan.utils import Context, ContextRepo, apply_types def test_context_getattr(context: ContextRepo): a = 1000 context.set_global("key", a) assert context.key is
a
49536cddc2dcf5216925fcaa750671623a12d0f2
66
v2_extractor_at_anchor
Lancetnik/Propan
49536cddc2dcf5216925fcaa750671623a12d0f2
66
train
train
tests/utils/context/test_main.py
use
assert
numeric_literal
9
import pytest from pydantic import ValidationError from propan.utils import Context, ContextRepo, apply_types @apply_types def use(key=Context(), key2=Context()): assert key ==
1
49536cddc2dcf5216925fcaa750671623a12d0f2
66
v2_extractor_at_anchor
Lancetnik/Propan
49536cddc2dcf5216925fcaa750671623a12d0f2
66
train
train
tests/utils/context/test_main.py
test_context_getattr
assert
none_literal
12
import pytest from pydantic import ValidationError from propan.utils import Context, ContextRepo, apply_types def test_context_getattr(context: ContextRepo): a = 1000 context.set_global("key", a) assert context.key is a assert context.key2 is
None
49536cddc2dcf5216925fcaa750671623a12d0f2
66
v2_extractor_at_anchor
Lancetnik/Propan
49536cddc2dcf5216925fcaa750671623a12d0f2
66
train
train
tests/utils/context/test_main.py
test_reset_global
pytest.raises
variable
17
import pytest from pydantic import ValidationError from propan.utils import Context, ContextRepo, apply_types @pytest.mark.asyncio async def test_reset_global(context: ContextRepo): a = 1000 context.set_global("key", a) context.reset_global("key") @apply_types async def use(key=Context()): # pra...
ValidationError)
49536cddc2dcf5216925fcaa750671623a12d0f2
66
v2_extractor_at_anchor
Lancetnik/Propan
49536cddc2dcf5216925fcaa750671623a12d0f2
66
train
train
tests/utils/test_classes.py
test_drop
assert
variable
7
from propan.utils.classes import Singleton def test_drop(): s1 = Singleton() s1._drop() assert Singleton() is not
s1
49536cddc2dcf5216925fcaa750671623a12d0f2
66
v2_extractor_at_anchor
Lancetnik/Propan
49536cddc2dcf5216925fcaa750671623a12d0f2
66
train
train
tests/utils/test_classes.py
test_singleton
assert
func_call
5
from propan.utils.classes import Singleton def test_singleton(): assert Singleton() is
Singleton()
49536cddc2dcf5216925fcaa750671623a12d0f2
66
v2_extractor_at_anchor
Lancetnik/Propan
49536cddc2dcf5216925fcaa750671623a12d0f2
66
train
train
tests/utils/test_functions.py
test_call
assert
numeric_literal
14
import pytest from propan.utils.functions import call_or_await def sync_func(a): return a async def async_func(a): return a @pytest.mark.asyncio async def test_call(): assert (await call_or_await(sync_func, a=3)) ==
3
49536cddc2dcf5216925fcaa750671623a12d0f2
66
v2_extractor_at_anchor
Lancetnik/Propan
49536cddc2dcf5216925fcaa750671623a12d0f2
66
train
train
tests/utils/type_cast/test_base.py
test_int
assert
collection
15
from typing import Tuple import pytest from propan.utils import apply_types def cast_int(t: int = 1) -> Tuple[bool, int]: return isinstance(t, int), t def cast_default(t: int = 1) -> Tuple[bool, int]: return isinstance(t, int), t def test_int(): assert cast_int("1") ==
(True, 1)
49536cddc2dcf5216925fcaa750671623a12d0f2
66
v2_extractor_at_anchor
Lancetnik/Propan
49536cddc2dcf5216925fcaa750671623a12d0f2
66
train
train
tests/utils/type_cast/test_base.py
test_int
assert
collection
18
from typing import Tuple import pytest from propan.utils import apply_types def cast_int(t: int = 1) -> Tuple[bool, int]: return isinstance(t, int), t def cast_default(t: int = 1) -> Tuple[bool, int]: return isinstance(t, int), t def test_int(): assert cast_int("1") == (True, 1) assert cast_int(t=...
(True, 2)
49536cddc2dcf5216925fcaa750671623a12d0f2
66
v2_extractor_at_anchor
Lancetnik/Propan
49536cddc2dcf5216925fcaa750671623a12d0f2
66
train
train
tests/utils/type_cast/test_base.py
test_int
assert
collection
21
from typing import Tuple import pytest from propan.utils import apply_types def cast_int(t: int = 1) -> Tuple[bool, int]: return isinstance(t, int), t def cast_default(t: int = 1) -> Tuple[bool, int]: return isinstance(t, int), t def test_int(): assert cast_int("1") == (True, 1) assert cast_int(t=...
(True, 0)
49536cddc2dcf5216925fcaa750671623a12d0f2
66
v2_extractor_at_anchor
Lancetnik/Propan
49536cddc2dcf5216925fcaa750671623a12d0f2
66
train
train
tests/utils/type_cast/test_model.py
test_model
pytest.raises
variable
22
from typing import Tuple import pytest from pydantic import BaseModel from propan.utils import apply_types def cast_model(t: Base) -> Tuple[bool, Base]: return isinstance(t, Base), t def test_model(): is_casted, m = cast_model({"field": 1}) assert is_casted, m.field == (True, 1) is_casted, m = cast...
ValueError)
49536cddc2dcf5216925fcaa750671623a12d0f2
66
v2_extractor_at_anchor
LonamiWebs/Telethon
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
train
train
tests/readthedocs/quick_references/test_client_reference.py
test_all_methods_present
assert
numeric_literal
10
import re from telethon import TelegramClient def test_all_methods_present(docs_dir): with (docs_dir / 'quick-references/client-reference.rst').open(encoding='utf-8') as fd: present_methods = set(map(str.lstrip, re.findall(r'^ {4}\w+$', fd.read(), re.MULTILINE))) assert len(present_methods) >
0
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
v2_extractor_at_anchor
LonamiWebs/Telethon
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
train
train
tests/readthedocs/quick_references/test_client_reference.py
test_all_methods_present
assert
variable
14
import re from telethon import TelegramClient def test_all_methods_present(docs_dir): with (docs_dir / 'quick-references/client-reference.rst').open(encoding='utf-8') as fd: present_methods = set(map(str.lstrip, re.findall(r'^ {4}\w+$', fd.read(), re.MULTILINE))) assert len(present_methods) > 0 f...
present_methods
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
v2_extractor_at_anchor
LonamiWebs/Telethon
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
train
train
tests/telethon/client/test_messages.py
send_file
assert
variable
18
import inspect import pytest from telethon import TelegramClient class MockedClient(TelegramClient): def __init__(self): pass async def send_file(self, entity, file, **kwargs): assert entity == 'a' assert file == 'b' for k, v in arguments.items():...
v
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
v2_extractor_at_anchor
LonamiWebs/Telethon
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
train
train
tests/telethon/client/test_messages.py
send_file
assert
string_literal
14
import inspect import pytest from telethon import TelegramClient class MockedClient(TelegramClient): def __init__(self): pass async def send_file(self, entity, file, **kwargs): assert entity ==
'a'
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
v2_extractor_at_anchor
LonamiWebs/Telethon
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
train
train
tests/telethon/client/test_messages.py
send_file
assert
string_literal
15
import inspect import pytest from telethon import TelegramClient class MockedClient(TelegramClient): def __init__(self): pass async def send_file(self, entity, file, **kwargs): assert entity == 'a' assert file ==
'b'
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
v2_extractor_at_anchor
LonamiWebs/Telethon
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
train
train
tests/telethon/client/test_messages.py
send_file
assert
variable
17
import inspect import pytest from telethon import TelegramClient class MockedClient(TelegramClient): def __init__(self): pass async def send_file(self, entity, file, **kwargs): assert entity == 'a' assert file == 'b' for k, v in arguments.items():...
kwargs
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
v2_extractor_at_anchor
LonamiWebs/Telethon
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
train
train
tests/telethon/client/test_messages.py
test_send_message_with_file_forwards_args
assert
variable
40
import inspect import pytest from telethon import TelegramClient @pytest.mark.asyncio async def test_send_message_with_file_forwards_args(): arguments = {} sentinel = object() for value, name in enumerate(inspect.signature(TelegramClient.send_message).parameters): if name in {'self', 'entity', '...
sentinel
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
v2_extractor_at_anchor
LonamiWebs/Telethon
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
train
train
tests/telethon/crypto/test_rsa.py
test_encryption_inv_key
assert
none_literal
18
import pytest from telethon.crypto import rsa def server_key_fp(): """Factory to return a key, old if so chosen.""" def _server_key_fp(old: bool): for fp, data in rsa._server_keys.items(): _, old_key = data if old_key == old: return fp return _server_key_fp...
None
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
v2_extractor_at_anchor
LonamiWebs/Telethon
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
train
train
tests/telethon/events/test_chataction.py
test_get_input_users_no_action_message_no_entities
assert
collection
25
import pytest from telethon import TelegramClient, events, types, utils def get_client(): return TelegramClient(None, 1, '1') def get_user_456(): return types.User( id=456, access_hash=789, first_name='User 123' ) @pytest.mark.asyncio async def test_get_input_users_no_action_mess...
[]
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
v2_extractor_at_anchor
LonamiWebs/Telethon
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
train
train
tests/telethon/events/test_chataction.py
test_get_users_no_action_message
assert
collection
27
import pytest from telethon import TelegramClient, events, types, utils def get_client(): return TelegramClient(None, 1, '1') def get_user_456(): return types.User( id=456, access_hash=789, first_name='User 123' ) @pytest.mark.asyncio async def test_get_users_no_action_message():...
[user]
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
v2_extractor_at_anchor
LonamiWebs/Telethon
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
train
train
tests/telethon/events/test_chataction.py
test_get_input_users_no_action_message
assert
collection
27
import pytest from telethon import TelegramClient, events, types, utils def get_client(): return TelegramClient(None, 1, '1') def get_user_456(): return types.User( id=456, access_hash=789, first_name='User 123' ) @pytest.mark.asyncio async def test_get_input_users_no_action_mess...
[utils.get_input_peer(user)]
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
v2_extractor_at_anchor
LonamiWebs/Telethon
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
train
train
tests/telethon/extensions/test_html.py
test_offset_at_emoji
assert
variable
14
from telethon.extensions import html from telethon.tl.types import MessageEntityBold, MessageEntityItalic, MessageEntityTextUrl def test_offset_at_emoji(): """ Tests that an entity starting at a emoji preserves the emoji. """ text = 'Hi\n👉 See example' entities = [MessageEntityBold(0, 2), MessageE...
parsed
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
v2_extractor_at_anchor
LonamiWebs/Telethon
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
train
train
tests/telethon/extensions/test_html.py
test_entities_together
assert
variable
13
from telethon.extensions import html from telethon.tl.types import MessageEntityBold, MessageEntityItalic, MessageEntityTextUrl def test_entities_together(): """ Test that an entity followed immediately by a different one behaves well. """ original = '<strong>⚙️</strong><em>Settings</em>' stripped ...
stripped
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
v2_extractor_at_anchor
LonamiWebs/Telethon
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
train
train
tests/telethon/extensions/test_html.py
test_entities_together
assert
variable
17
from telethon.extensions import html from telethon.tl.types import MessageEntityBold, MessageEntityItalic, MessageEntityTextUrl def test_entities_together(): """ Test that an entity followed immediately by a different one behaves well. """ original = '<strong>⚙️</strong><em>Settings</em>' stripped ...
original
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
v2_extractor_at_anchor
LonamiWebs/Telethon
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
train
train
tests/telethon/extensions/test_html.py
test_offset_at_emoji
assert
collection
13
from telethon.extensions import html from telethon.tl.types import MessageEntityBold, MessageEntityItalic, MessageEntityTextUrl def test_offset_at_emoji(): """ Tests that an entity starting at a emoji preserves the emoji. """ text = 'Hi\n👉 See example' entities = [MessageEntityBold(0, 2), MessageE...
(text, entities)
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
v2_extractor_at_anchor
LonamiWebs/Telethon
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
train
train
tests/telethon/extensions/test_html.py
test_entity_edges
assert
string_literal
12
from telethon.extensions import html from telethon.tl.types import MessageEntityBold, MessageEntityItalic, MessageEntityTextUrl def test_entity_edges(): """ Test that entities at the edges (start and end) don't crash. """ text = 'Hello, world' entities = [MessageEntityBold(0, 5), MessageEntityBold(...
'<strong>Hello</strong>, <strong>world</strong>'
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
v2_extractor_at_anchor
LonamiWebs/Telethon
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
train
train
tests/telethon/extensions/test_html.py
test_entities_together
assert
collection
14
from telethon.extensions import html from telethon.tl.types import MessageEntityBold, MessageEntityItalic, MessageEntityTextUrl def test_entities_together(): """ Test that an entity followed immediately by a different one behaves well. """ original = '<strong>⚙️</strong><em>Settings</em>' stripped ...
[MessageEntityBold(0, 2), MessageEntityItalic(2, 8)]
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
v2_extractor_at_anchor
LonamiWebs/Telethon
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
train
train
tests/telethon/extensions/test_html.py
test_trailing_malformed_entities
assert
string_literal
14
from telethon.extensions import html from telethon.tl.types import MessageEntityBold, MessageEntityItalic, MessageEntityTextUrl def test_trailing_malformed_entities(): """ Similar to `test_malformed_entities`, but for the edge case where the malformed entity offset is right at the end (note the lack of...
'🏆<a href="https://example.com">Telegram Official Android Challenge is over</a>🏆'
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
v2_extractor_at_anchor
LonamiWebs/Telethon
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
train
train
tests/telethon/extensions/test_html.py
test_malformed_entities
assert
string_literal
13
from telethon.extensions import html from telethon.tl.types import MessageEntityBold, MessageEntityItalic, MessageEntityTextUrl def test_malformed_entities(): """ Test that malformed entity offsets from bad clients don't crash and produce the expected results. """ text = '🏆Telegram Official Androi...
'🏆<a href="https://example.com">Telegram Official Android Challenge is over</a>🏆.'
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
v2_extractor_at_anchor
LonamiWebs/Telethon
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
train
train
tests/telethon/extensions/test_markdown.py
test_offset_at_emoji
assert
variable
14
from telethon.extensions import markdown from telethon.tl.types import MessageEntityBold, MessageEntityItalic, MessageEntityTextUrl def test_offset_at_emoji(): """ Tests that an entity starting at a emoji preserves the emoji. """ text = 'Hi\n👉 See example' entities = [MessageEntityBold(0, 2), Mess...
parsed
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
v2_extractor_at_anchor
LonamiWebs/Telethon
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
train
train
tests/telethon/extensions/test_markdown.py
test_entities_together
assert
variable
13
from telethon.extensions import markdown from telethon.tl.types import MessageEntityBold, MessageEntityItalic, MessageEntityTextUrl def test_entities_together(): """ Test that an entity followed immediately by a different one behaves well. """ original = '**⚙️**__Settings__' stripped = '⚙️Settings'...
stripped
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
v2_extractor_at_anchor
LonamiWebs/Telethon
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
train
train
tests/telethon/extensions/test_markdown.py
test_entities_together
assert
variable
17
from telethon.extensions import markdown from telethon.tl.types import MessageEntityBold, MessageEntityItalic, MessageEntityTextUrl def test_entities_together(): """ Test that an entity followed immediately by a different one behaves well. """ original = '**⚙️**__Settings__' stripped = '⚙️Settings'...
original
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
v2_extractor_at_anchor
LonamiWebs/Telethon
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
train
train
tests/telethon/extensions/test_markdown.py
test_offset_at_emoji
assert
collection
13
from telethon.extensions import markdown from telethon.tl.types import MessageEntityBold, MessageEntityItalic, MessageEntityTextUrl def test_offset_at_emoji(): """ Tests that an entity starting at a emoji preserves the emoji. """ text = 'Hi\n👉 See example' entities = [MessageEntityBold(0, 2), Mess...
(text, entities)
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
v2_extractor_at_anchor
LonamiWebs/Telethon
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
train
train
tests/telethon/extensions/test_markdown.py
test_entity_edges
assert
string_literal
12
from telethon.extensions import markdown from telethon.tl.types import MessageEntityBold, MessageEntityItalic, MessageEntityTextUrl def test_entity_edges(): """ Test that entities at the edges (start and end) don't crash. """ text = 'Hello, world' entities = [MessageEntityBold(0, 5), MessageEntityB...
'**Hello**, **world**'
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
v2_extractor_at_anchor
LonamiWebs/Telethon
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
train
train
tests/telethon/extensions/test_markdown.py
test_entities_together
assert
collection
14
from telethon.extensions import markdown from telethon.tl.types import MessageEntityBold, MessageEntityItalic, MessageEntityTextUrl def test_entities_together(): """ Test that an entity followed immediately by a different one behaves well. """ original = '**⚙️**__Settings__' stripped = '⚙️Settings'...
[MessageEntityBold(0, 2), MessageEntityItalic(2, 8)]
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
v2_extractor_at_anchor
LonamiWebs/Telethon
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
train
train
tests/telethon/extensions/test_markdown.py
test_trailing_malformed_entities
assert
string_literal
14
from telethon.extensions import markdown from telethon.tl.types import MessageEntityBold, MessageEntityItalic, MessageEntityTextUrl def test_trailing_malformed_entities(): """ Similar to `test_malformed_entities`, but for the edge case where the malformed entity offset is right at the end (note the lac...
"🏆[Telegram Official Android Challenge is over](https://example.com)🏆"
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
v2_extractor_at_anchor
LonamiWebs/Telethon
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
train
train
tests/telethon/extensions/test_markdown.py
test_malformed_entities
assert
string_literal
13
from telethon.extensions import markdown from telethon.tl.types import MessageEntityBold, MessageEntityItalic, MessageEntityTextUrl def test_malformed_entities(): """ Test that malformed entity offsets from bad clients don't crash and produce the expected results. """ text = '🏆Telegram Official An...
"🏆[Telegram Official Android Challenge is over](https://example.com)🏆."
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
v2_extractor_at_anchor
LonamiWebs/Telethon
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
train
train
tests/telethon/test_helpers.py
test_sync_acontext
assert
numeric_literal
12
from base64 import b64decode import pytest from telethon import helpers class TestSyncifyAsyncContext: def test_sync_acontext(self, event_loop): contm = self.NoopContextManager(event_loop) assert contm.count ==
0
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
v2_extractor_at_anchor
LonamiWebs/Telethon
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
train
train
tests/telethon/test_helpers.py
test_sync_acontext
assert
numeric_literal
15
from base64 import b64decode import pytest from telethon import helpers class TestSyncifyAsyncContext: def test_sync_acontext(self, event_loop): contm = self.NoopContextManager(event_loop) assert contm.count == 0 with contm: assert contm.count ==
1
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
v2_extractor_at_anchor
LonamiWebs/Telethon
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
train
train
tests/telethon/test_helpers.py
__aexit__
assert
none_literal
20
from base64 import b64decode import pytest from telethon import helpers class NoopContextManager: def __init__(self, loop): self.count = 0 self.loop = loop async def __aenter__(self): self.count += 1 return self async def __aexit__(self, e...
None
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
v2_extractor_at_anchor
LonamiWebs/Telethon
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
train
train
tests/telethon/test_helpers.py
test_strip_text
assert
string_literal
9
from base64 import b64decode import pytest from telethon import helpers def test_strip_text(): assert helpers.strip_text(" text ", []) ==
"text"
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
v2_extractor_at_anchor
LonamiWebs/Telethon
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
train
train
tests/telethon/test_helpers.py
test_generate_key_data_from_nonce
assert
collection
13
from base64 import b64decode import pytest from telethon import helpers def test_generate_key_data_from_nonce(): gkdfn = helpers.generate_key_data_from_nonce key_expect = b64decode(b'NFwRFB8Knw/kAmvPWjtrQauWysHClVfQh0UOAaABqZA=') nonce_expect = b64decode(b'1AgjhU9eDvJRjFik73bjR2zZEATzL/jLu9yodYfWEgA=') ...
(key_expect, nonce_expect)
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
v2_extractor_at_anchor
LonamiWebs/Telethon
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
train
train
tests/telethon/test_pickle.py
_assert_equality
assert
complex_expr
7
import pickle from telethon.errors import RPCError, BadRequestError, FileIdInvalidError, NetworkMigrateError def _assert_equality(error, unpickled_error): assert error.code ==
unpickled_error.code
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
v2_extractor_at_anchor
LonamiWebs/Telethon
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
train
train
tests/telethon/test_pickle.py
_assert_equality
assert
func_call
10
import pickle from telethon.errors import RPCError, BadRequestError, FileIdInvalidError, NetworkMigrateError def _assert_equality(error, unpickled_error): assert error.code == unpickled_error.code assert error.message == unpickled_error.message assert type(error) == type(unpickled_error) assert str(e...
str(unpickled_error)
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
v2_extractor_at_anchor
LonamiWebs/Telethon
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
train
train
tests/telethon/test_pickle.py
_assert_equality
assert
func_call
9
import pickle from telethon.errors import RPCError, BadRequestError, FileIdInvalidError, NetworkMigrateError def _assert_equality(error, unpickled_error): assert error.code == unpickled_error.code assert error.message == unpickled_error.message assert type(error) ==
type(unpickled_error)
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
v2_extractor_at_anchor
LonamiWebs/Telethon
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
train
train
tests/telethon/test_pickle.py
test_fancy_rpcerror_capture_pickle
assert
complex_expr
16
import pickle from telethon.errors import RPCError, BadRequestError, FileIdInvalidError, NetworkMigrateError def _assert_equality(error, unpickled_error): assert error.code == unpickled_error.code assert error.message == unpickled_error.message assert type(error) == type(unpickled_error) assert str(er...
unpickled_error.new_dc
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
v2_extractor_at_anchor
LonamiWebs/Telethon
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
train
train
tests/telethon/test_pickle.py
_assert_equality
assert
complex_expr
8
import pickle from telethon.errors import RPCError, BadRequestError, FileIdInvalidError, NetworkMigrateError def _assert_equality(error, unpickled_error): assert error.code == unpickled_error.code assert error.message ==
unpickled_error.message
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
v2_extractor_at_anchor
LonamiWebs/Telethon
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
train
train
tests/telethon/test_utils.py
test_private_get_extension
assert
string_literal
33
import io import pathlib from telethon import utils from telethon.tl.types import ( MessageMediaGame, Game, PhotoEmpty ) def test_private_get_extension(): # Positive cases png_header = bytes.fromhex('89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52') png_buffer = io.BytesIO(png_header) class Cust...
''
9a86447b6eca810d5c14211b154fc2ec3236cf58
37
v2_extractor_at_anchor
LuteOrg/lute-v3
def058934893f96b4e922f21f794c654faa5fad4
307
train
train
plugins/lute-mandarin/tests/test_MandarinParser.py
test_readings
assert
none_literal
32
import tempfile import os import pytest from lute.models.term import Term from lute.parse.base import ParsedToken from lute_mandarin_parser.parser import MandarinParser def assert_tokens_equals(text, lang, expected): """ Parsing a text using a language should give the expected parsed tokens. expected is...
None
def058934893f96b4e922f21f794c654faa5fad4
307
v2_extractor_at_anchor
LuteOrg/lute-v3
def058934893f96b4e922f21f794c654faa5fad4
307
train
train
tests/orm/test_Book.py
test_load_book_loads_lang
assert
none_literal
30
from datetime import datetime import pytest from lute.models.book import Book, BookTag from lute.book.stats import BookStats from lute.db import db from tests.dbasserts import assert_sql_result, assert_record_count_equals def fixture_simple_book(english): "Single page book with some associated objects." b = Bo...
None
def058934893f96b4e922f21f794c654faa5fad4
307
v2_extractor_at_anchor
LuteOrg/lute-v3
def058934893f96b4e922f21f794c654faa5fad4
307
train
train
tests/orm/test_Term.py
test_save_replace_remove_image
assert
none_literal
28
import pytest from lute.models.term import Term, TermTag, TermTextChangedException from lute.db import db from tests.dbasserts import assert_sql_result def test_save_replace_remove_image(spanish): "Save saves the associated image." t = Term(spanish, "HOLA") t.set_current_image("hello.png") assert t.get...
None
def058934893f96b4e922f21f794c654faa5fad4
307
v2_extractor_at_anchor
LuteOrg/lute-v3
def058934893f96b4e922f21f794c654faa5fad4
307
train
train
tests/unit/backup/test_backup.py
test_last_import_setting_is_updated_on_successful_backup
assert
none_literal
77
import os from datetime import datetime, timezone from unittest.mock import Mock, patch import pytest from lute.backup.service import ( create_backup, BackupException, should_run_auto_backup, backup_warning, DatabaseBackupFile, list_backups, ) from lute.models.setting import BackupSettings utc...
None
def058934893f96b4e922f21f794c654faa5fad4
307
v2_extractor_at_anchor
LuteOrg/lute-v3
def058934893f96b4e922f21f794c654faa5fad4
307
train
train
tests/unit/cli/test_language_term_export.py
_find
assert
none_literal
13
from lute.cli.language_term_export import generate_language_file, generate_book_file from lute.models.term import Term, TermTag from lute.models.book import Book from lute.db import db from tests.dbasserts import assert_sql_result def _find(term_string): "Find term with the text." spec = Term(engl...
None
def058934893f96b4e922f21f794c654faa5fad4
307
v2_extractor_at_anchor
LuteOrg/lute-v3
def058934893f96b4e922f21f794c654faa5fad4
307
train
train
tests/unit/db/test_demo.py
test_tutorial_id_returned_if_present
assert
none_literal
22
from sqlalchemy import text import pytest from lute.db import db from lute.db.demo import ( contains_demo_data, remove_flag, delete_demo_data, tutorial_book_id, load_demo_data, ) import lute.parse.registry from tests.dbasserts import assert_record_count_equals, assert_sql_result def test_tutorial_i...
None
def058934893f96b4e922f21f794c654faa5fad4
307
v2_extractor_at_anchor
LuteOrg/lute-v3
def058934893f96b4e922f21f794c654faa5fad4
307
train
train
tests/unit/db/test_management.py
test_can_get_backup_settings_when_db_is_wiped
assert
none_literal
13
import pytest from lute.db import db from lute.models.setting import UserSetting, BackupSettings from lute.db.management import delete_all_data from tests.dbasserts import assert_record_count_equals def test_can_get_backup_settings_when_db_is_wiped(app_context): "The backupsettings struct assumes certain things ab...
None
def058934893f96b4e922f21f794c654faa5fad4
307
v2_extractor_at_anchor
LuteOrg/lute-v3
def058934893f96b4e922f21f794c654faa5fad4
307
train
train
tests/unit/models/test_Language.py
test_can_find_lang_by_name
assert
none_literal
16
from lute.models.language import Language from tests.dbasserts import assert_sql_result def test_can_find_lang_by_name(app_context): """ Returns lang if found, or None """ e = Language.find_by_name("English") assert e.name == "English", "case match" e_lc = Language.find_by_name("english") ...
None
def058934893f96b4e922f21f794c654faa5fad4
307
v2_extractor_at_anchor
LuteOrg/lute-v3
def058934893f96b4e922f21f794c654faa5fad4
307
train
train
tests/unit/models/test_Setting.py
test_user_and_system_settings_do_not_intersect
assert
none_literal
23
import os from unittest.mock import patch import pytest from sqlalchemy import text from lute.db import db from lute.models.setting import ( UserSetting, MissingUserSettingKeyException, SystemSetting, BackupSettings, ) from tests.dbasserts import assert_sql_result def test_user_and_system_settings_do_n...
None
def058934893f96b4e922f21f794c654faa5fad4
307
v2_extractor_at_anchor
LuteOrg/lute-v3
def058934893f96b4e922f21f794c654faa5fad4
307
train
train
plugins/lute-mandarin/tests/test_MandarinParser.py
test_readings
assert
complex_expr
37
import tempfile import os import pytest from lute.models.term import Term from lute.parse.base import ParsedToken from lute_mandarin_parser.parser import MandarinParser def assert_tokens_equals(text, lang, expected): """ Parsing a text using a language should give the expected parsed tokens. expected is...
c[1]
def058934893f96b4e922f21f794c654faa5fad4
307
v2_extractor_at_anchor
LuteOrg/lute-v3
def058934893f96b4e922f21f794c654faa5fad4
307
train
train
tests/unit/models/test_Term.py
test_find_by_spec
assert
complex_expr
19
import datetime import pytest from sqlalchemy import text from lute.models.term import Term, TermImage from lute.db import db from tests.dbasserts import assert_record_count_equals, assert_sql_result def test_find_by_spec(app_context, spanish, english): """ Can find by spec, matches on language and text. "...
t.id
def058934893f96b4e922f21f794c654faa5fad4
307
v2_extractor_at_anchor
LuteOrg/lute-v3
def058934893f96b4e922f21f794c654faa5fad4
307
train
train
tests/unit/parse/test_JapaneseParser.py
test_readings
assert
complex_expr
41
from lute.parse.mecab_parser import JapaneseParser from lute.models.term import Term from lute.models.setting import UserSetting from lute.db import db from lute.parse.base import ParsedToken def assert_tokens_equals(text, lang, expected): """ Parsing a text using a language should give the expected parsed tok...
c[1]
def058934893f96b4e922f21f794c654faa5fad4
307
v2_extractor_at_anchor
LuteOrg/lute-v3
def058934893f96b4e922f21f794c654faa5fad4
307
train
train
tests/unit/term/test_Repository.py
test_load
assert
complex_expr
45
from datetime import datetime import pytest from lute.models.term import Term as DBTerm, TermTag from lute.db import db from lute.term.model import Term, Repository from tests.dbasserts import assert_sql_result, assert_record_count_equals from tests.utils import add_terms, make_text def fixture_repo(): return Rep...
t.id
def058934893f96b4e922f21f794c654faa5fad4
307
v2_extractor_at_anchor
LuteOrg/lute-v3
def058934893f96b4e922f21f794c654faa5fad4
307
train
train
plugins/lute-mandarin/tests/test_MandarinParser.py
test_token_count
assert
complex_expr
25
import tempfile import os import pytest from lute.models.term import Term from lute.parse.base import ParsedToken from lute_mandarin_parser.parser import MandarinParser def test_token_count(mandarin_chinese): """ token_count checks. """ cases = [ ("我", 1), ("运气", 1), ("你说", 2)...
t.text
def058934893f96b4e922f21f794c654faa5fad4
307
v2_extractor_at_anchor
LuteOrg/lute-v3
def058934893f96b4e922f21f794c654faa5fad4
307
train
train
tests/unit/parse/test_JapaneseParser.py
test_token_count
assert
complex_expr
14
from lute.parse.mecab_parser import JapaneseParser from lute.models.term import Term from lute.models.setting import UserSetting from lute.db import db from lute.parse.base import ParsedToken def test_token_count(japanese): "token_count checks." cases = [("私", 1), ("元気", 1), ("です", 1), ("元気です", 2), ("元気です私", 3...
t.text
def058934893f96b4e922f21f794c654faa5fad4
307
v2_extractor_at_anchor
LuteOrg/lute-v3
def058934893f96b4e922f21f794c654faa5fad4
307
train
train
tests/unit/backup/test_backup.py
test_database_backup_file_with_auto_backup_returns_success
assert
complex_expr
77
import os from datetime import datetime, timezone from unittest.mock import Mock, patch import pytest from lute.backup.service import ( create_backup, BackupException, should_run_auto_backup, backup_warning, DatabaseBackupFile, list_backups, ) from lute.models.setting import BackupSettings utc...
dbf.name
def058934893f96b4e922f21f794c654faa5fad4
307
v2_extractor_at_anchor
LuteOrg/lute-v3
def058934893f96b4e922f21f794c654faa5fad4
307
train
train
tests/unit/themes/test_service.py
test_next_theme_cycles_themes
assert
complex_expr
13
import os import lute.themes.service as svc from lute.db import db from lute.models.setting import UserSetting def test_next_theme_cycles_themes(app_context): """ Users should be able to move the 'next' theme quickly while reading, via a hotkey. """ lst = svc.list_themes() assert UserSetting.g...
lst[0][0]
def058934893f96b4e922f21f794c654faa5fad4
307
v2_extractor_at_anchor
LuteOrg/lute-v3
def058934893f96b4e922f21f794c654faa5fad4
307
train
train
tests/unit/themes/test_service.py
test_next_theme_cycles_themes
assert
complex_expr
15
import os import lute.themes.service as svc from lute.db import db from lute.models.setting import UserSetting def test_next_theme_cycles_themes(app_context): """ Users should be able to move the 'next' theme quickly while reading, via a hotkey. """ lst = svc.list_themes() assert UserSetting.ge...
lst[1][0]
def058934893f96b4e922f21f794c654faa5fad4
307
v2_extractor_at_anchor