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
stabldev/torrra
from pathlib import Path import pytest from torrra.core.cache import Cache def cache(tmp_path: Path): # provides a cache instance that uses a temporary directory cache_dir = tmp_path / "test_cache" cache_instance = Cache(cache_dir) yield cache_instance cache_instance.close() def test_make_key_con...
key2
assert
variable
tests/test_core_cache.py
test_make_key_consistency
20
null
stabldev/torrra
from typing import Any, cast import pytest from textual.widgets import ListView from torrra.app import TorrraApp from torrra.core.config import Config from torrra.screens.theme_selector import ThemeSelectorScreen def app(app_factory: Any) -> TorrraApp: app = app_factory() app.theme = "textual-dark" # defaul...
2
assert
numeric_literal
tests/screens/test_theme_selector.py
test_theme_selector_opens_and_closes_with_escape
25
null
stabldev/torrra
import httpx import respx from torrra.utils.magnet import resolve_magnet_uri async def test_resolve_already_magnet(): # tests that a magnet uri is returned as is magnet = "magnet:?xt=urn:btih:test" resolved = await resolve_magnet_uri(magnet) assert resolved ==
magnet
assert
variable
tests/test_utils_magnet.py
test_resolve_already_magnet
11
null
stabldev/torrra
from typing import cast from unittest.mock import MagicMock import pytest from textual.coordinate import Coordinate from textual.widgets import DataTable, Static from torrra._types import Indexer, Torrent from torrra.app import TorrraApp from torrra.screens.home import HomeScreen def app(): # start app on Search...
"Arch Linux ISO (Mock)"
assert
string_literal
tests/screens/test_home.py
test_home_screen_search
49
null
stabldev/torrra
from unittest.mock import MagicMock import pytest from click.testing import CliRunner from torrra.__main__ import cli from torrra._version import __version__ @pytest.mark.usefixtures("mock_config") def test_config_commands_flow(): # tests the full get/set/list flow for the config command runner = CliRunner()...
get_result.output
assert
complex_expr
tests/test_cli.py
test_config_commands_flow
71
null
stabldev/torrra
import pytest from torrra.core import config as config_module from torrra.core.config import Config from torrra.core.exceptions import ConfigError def test_config_list_flattens_correctly(mock_config: Config): # test that list method correctly flattens mock_config.set("general.theme", "new-theme") mock_con...
config_list
assert
variable
tests/test_core_config.py
test_config_list_flattens_correctly
65
null
stabldev/torrra
from httpx import Response import pytest import respx from torrra.indexers.base import BaseIndexer from torrra.indexers.jackett import JackettIndexer from torrra.indexers.prowlarr import ProwlarrIndexer MOCK_API_URL = "http://mock.indexer.url" MOCK_API_KEY = "mock_api_key" MOCK_SEARCH_RESPONSE = { "jackett": { ...
17
assert
numeric_literal
tests/test_indexers.py
test_search
59
null
stabldev/torrra
from typing import cast from unittest.mock import MagicMock import pytest from textual.coordinate import Coordinate from textual.widgets import DataTable, Static from torrra._types import Indexer, Torrent from torrra.app import TorrraApp from torrra.screens.home import HomeScreen def app(): # start app on Search...
len(mock_indexer.search.return_value)
assert
func_call
tests/screens/test_home.py
test_home_screen_search
48
null
stabldev/torrra
from typing import Any, cast import pytest from textual.widgets import ListView from torrra.app import TorrraApp from torrra.core.config import Config from torrra.screens.theme_selector import ThemeSelectorScreen def app(app_factory: Any) -> TorrraApp: app = app_factory() app.theme = "textual-dark" # defaul...
initial_index
assert
variable
tests/screens/test_theme_selector.py
test_theme_selector_navigation_with_j_and_k
40
null
stabldev/torrra
import pytest from torrra.utils.helpers import human_readable_size, lazy_import def test_lazy_import_failure(): with pytest.raises(ImportError) as exc: lazy_import("nonexistent_mod.func") assert "nonexistent_mod.func" in
str(exc.value)
assert
func_call
tests/test_utils_helpers.py
test_lazy_import_failure
23
null
stabldev/torrra
from typing import Any, cast import pytest from textual.widgets import ListView from torrra.app import TorrraApp from torrra.core.config import Config from torrra.screens.theme_selector import ThemeSelectorScreen def app(app_factory: Any) -> TorrraApp: app = app_factory() app.theme = "textual-dark" # defaul...
original_theme
assert
variable
tests/screens/test_theme_selector.py
test_theme_selector_cancel_selection_with_escape
97
null
stabldev/torrra
from unittest.mock import MagicMock import pytest from click.testing import CliRunner from torrra.__main__ import cli from torrra._version import __version__ def test_cli_version(): # tests that the --version flag works runner = CliRunner() result = runner.invoke(cli, ["--version"]) assert result.ex...
0
assert
numeric_literal
tests/test_cli.py
test_cli_version
14
null
stabldev/torrra
import pytest from torrra.utils.helpers import human_readable_size, lazy_import def test_human_readable_size(): assert human_readable_size(1023) == "1023.00 B" assert human_readable_size(1024) == "1.00 KB" assert human_readable_size(1500) ==
"1.46 KB"
assert
string_literal
tests/test_utils_helpers.py
test_human_readable_size
9
null
stabldev/torrra
import pytest from torrra.utils.helpers import human_readable_size, lazy_import def test_lazy_import_failure(): with pytest.raises(
ImportError)
pytest.raises
variable
tests/test_utils_helpers.py
test_lazy_import_failure
20
null
stabldev/torrra
import pytest from torrra.utils.helpers import human_readable_size, lazy_import def test_human_readable_size(): assert human_readable_size(1023) == "1023.00 B" assert human_readable_size(1024) ==
"1.00 KB"
assert
string_literal
tests/test_utils_helpers.py
test_human_readable_size
8
null
stabldev/torrra
from typing import Any, cast import pytest from textual.widgets import ListView from torrra.app import TorrraApp from torrra.core.config import Config from torrra.screens.theme_selector import ThemeSelectorScreen def app(app_factory: Any) -> TorrraApp: app = app_factory() app.theme = "textual-dark" # defaul...
3
assert
numeric_literal
tests/screens/test_theme_selector.py
test_theme_selector_opens_and_closes_with_escape
22
null
stabldev/torrra
from typing import cast from unittest.mock import MagicMock import pytest from textual.coordinate import Coordinate from textual.widgets import DataTable, Static from torrra._types import Indexer, Torrent from torrra.app import TorrraApp from torrra.screens.home import HomeScreen def app(): # start app on Search...
str(loader_status.content)
assert
func_call
tests/screens/test_home.py
test_home_screen_search_no_results
62
null
stabldev/torrra
from httpx import Response import pytest import respx from torrra.indexers.base import BaseIndexer from torrra.indexers.jackett import JackettIndexer from torrra.indexers.prowlarr import ProwlarrIndexer MOCK_API_URL = "http://mock.indexer.url" MOCK_API_KEY = "mock_api_key" MOCK_SEARCH_RESPONSE = { "jackett": { ...
523
assert
numeric_literal
tests/test_indexers.py
test_search
58
null
stabldev/torrra
import pytest from torrra.core import config as config_module from torrra.core.config import Config from torrra.core.exceptions import ConfigError def test_config_get_nonexistent_with_default(mock_config: Config): # test that a default value is returned for a non-existent key assert mock_config.get("general....
"default"
assert
string_literal
tests/test_core_config.py
test_config_get_nonexistent_with_default
23
null
stabldev/torrra
import pytest from torrra.core import config as config_module from torrra.core.config import Config from torrra.core.exceptions import ConfigError def test_config_set_type_conversion(mock_config: Config): # test that string values are correctly converted to other types mock_config.set("types.bool_true", "true...
123
assert
numeric_literal
tests/test_core_config.py
test_config_set_type_conversion
53
null
stabldev/torrra
import pytest from torrra.core import config as config_module from torrra.core.config import Config from torrra.core.exceptions import ConfigError def test_config_set_type_conversion(mock_config: Config): # test that string values are correctly converted to other types mock_config.set("types.bool_true", "true...
False
assert
bool_literal
tests/test_core_config.py
test_config_set_type_conversion
52
null
stabldev/torrra
import pytest from textual.widgets import Static from torrra._types import Indexer from torrra._version import __version__ from torrra.app import TorrraApp from torrra.screens.home import HomeScreen from torrra.screens.welcome import WelcomeScreen def app() -> TorrraApp: return TorrraApp( indexer=Indexer(...
version_text
assert
variable
tests/screens/test_welcome.py
test_welcome_screen_version_display
55
null
stabldev/torrra
import pytest from torrra.core import config as config_module from torrra.core.config import Config from torrra.core.exceptions import ConfigError def test_config_get_existing_value(mock_config: Config): # test getting a pre-existing value assert mock_config.get("general.use_cache") is
True
assert
bool_literal
tests/test_core_config.py
test_config_get_existing_value
18
null
stabldev/torrra
from typing import Any, cast import pytest from textual.widgets import ListView from torrra.app import TorrraApp from torrra.core.config import Config from torrra.screens.theme_selector import ThemeSelectorScreen def app(app_factory: Any) -> TorrraApp: app = app_factory() app.theme = "textual-dark" # defaul...
initial_index + 1
assert
complex_expr
tests/screens/test_theme_selector.py
test_theme_selector_navigation_with_j_and_k
37
null
stabldev/torrra
import pytest from torrra.utils.helpers import human_readable_size, lazy_import def test_human_readable_size(): assert human_readable_size(1023) ==
"1023.00 B"
assert
string_literal
tests/test_utils_helpers.py
test_human_readable_size
7
null
stabldev/torrra
from httpx import Response import pytest import respx from torrra.indexers.base import BaseIndexer from torrra.indexers.jackett import JackettIndexer from torrra.indexers.prowlarr import ProwlarrIndexer MOCK_API_URL = "http://mock.indexer.url" MOCK_API_KEY = "mock_api_key" MOCK_SEARCH_RESPONSE = { "jackett": { ...
1
assert
numeric_literal
tests/test_indexers.py
test_search
54
null
stabldev/torrra
import pytest from textual.widgets import Static from torrra._types import Indexer from torrra._version import __version__ from torrra.app import TorrraApp from torrra.screens.home import HomeScreen from torrra.screens.welcome import WelcomeScreen def app() -> TorrraApp: return TorrraApp( indexer=Indexer(...
query
assert
variable
tests/screens/test_welcome.py
test_welcome_screen_search_flow
33
null
stabldev/torrra
import httpx import respx from torrra.utils.magnet import resolve_magnet_uri @respx.mock async def test_resolve_http_redirect(): # tests that a 301/302 redirect is handled correctly test_url = "http://test.com/redirect" magnet_uri = "magnet:?xt=urn:btih:redirect" respx.get(test_url).mock(httpx.Respons...
magnet_uri
assert
variable
tests/test_utils_magnet.py
test_resolve_http_redirect
22
null
stabldev/torrra
import httpx import respx from torrra.utils.magnet import resolve_magnet_uri @respx.mock async def test_resolve_http_error_returns_none(): # tests that an http error results in none test_url = "http://test.com/error" respx.get(test_url).mock(side_effect=httpx.RequestError("test error")) resolved = aw...
None
assert
none_literal
tests/test_utils_magnet.py
test_resolve_http_error_returns_none
32
null
marshmallow-code/webargs
from unittest import mock from urllib.parse import urlencode import marshmallow as ma import pytest import tornado.concurrent import tornado.http1connection import tornado.httpserver import tornado.httputil import tornado.ioloop import tornado.testing import tornado.web from webargs import fields, missing, validate f...
True
assert
bool_literal
tests/test_tornadoparser.py
test_it_should_pass_parsed_as_first_argument
TestUseArgs
323
null
marshmallow-code/webargs
from unittest import mock import pytest from flask import Flask from marshmallow import Schema from werkzeug.exceptions import BadRequest, HTTPException from webargs import ValidationError, fields, missing from webargs.core import json from webargs.flaskparser import abort, parser from webargs.testing import CommonTe...
{}
assert
collection
tests/test_flaskparser.py
test_nested_many_with_data_key
TestFlaskParser
58
null
marshmallow-code/webargs
from unittest import mock import pytest from flask import Flask from marshmallow import Schema from werkzeug.exceptions import BadRequest, HTTPException from webargs import ValidationError, fields, missing from webargs.core import json from webargs.flaskparser import abort, parser from webargs.testing import CommonTe...
missing
assert
variable
tests/test_flaskparser.py
test_load_json_returns_missing_if_no_data
191
null
marshmallow-code/webargs
import pytest import webtest from webargs.core import json class CommonTestCase: def create_app(self): """Return a WSGI app""" raise NotImplementedError("Must define create_app()") def create_testapp(self, app): return webtest.TestApp(app) def before_create_app(self): pa...
in_data
assert
variable
src/webargs/testing.py
test_parse_nested_many_json
CommonTestCase
214
null
marshmallow-code/webargs
from unittest import mock from urllib.parse import urlencode import marshmallow as ma import pytest import tornado.concurrent import tornado.http1connection import tornado.httpserver import tornado.httputil import tornado.ioloop import tornado.testing import tornado.web from webargs import fields, missing, validate f...
422
assert
numeric_literal
tests/test_tornadoparser.py
test_missing_required_field_throws_422
TestValidateApp
564
null
marshmallow-code/webargs
from unittest import mock import pytest from flask import Flask from marshmallow import Schema from werkzeug.exceptions import BadRequest, HTTPException from webargs import ValidationError, fields, missing from webargs.core import json from webargs.flaskparser import abort, parser from webargs.testing import CommonTe...
422
assert
numeric_literal
tests/test_flaskparser.py
test_abort_called_on_validation_error
150
null
marshmallow-code/webargs
import falcon.testing import pytest from tests.apps.falcon_app import create_app, create_async_app from webargs.testing import CommonTestCase class TestFalconParser(CommonTestCase): def create_app(self): return create_app() def test_parse_media(self, testapp): assert testapp.post_json("/echo...
{ "name": "Fred" }
assert
collection
tests/test_falconparser.py
test_parse_media
TestFalconParser
20
null
marshmallow-code/webargs
import falcon.testing import pytest from tests.apps.falcon_app import create_app, create_async_app from webargs.testing import CommonTestCase class TestFalconParser(CommonTestCase): def create_app(self): return create_app() @pytest.mark.parametrize("path", ["/echo_json", "/echo_media"]) def test_...
400
assert
numeric_literal
tests/test_falconparser.py
test_parse_json_with_nonutf8_chars
TestFalconParser
44
null
marshmallow-code/webargs
import asyncio from io import BytesIO from unittest import mock import pytest import webtest import webtest_aiohttp from tests.apps.aiohttp_app import create_app from webargs import fields from webargs.aiohttpparser import AIOHTTPParser from webargs.testing import CommonTestCase def web_request(): req = mock.Moc...
{"name": "World"}
assert
collection
tests/test_aiohttpparser.py
test_use_args_on_method_handler
TestAIOHTTPParser
42
null
marshmallow-code/webargs
from unittest import mock import pytest from flask import Flask from marshmallow import Schema from werkzeug.exceptions import BadRequest, HTTPException from webargs import ValidationError, fields, missing from webargs.core import json from webargs.flaskparser import abort, parser from webargs.testing import CommonTe...
[expected_msg]
assert
collection
tests/test_flaskparser.py
test_abort_called_on_validation_error
152
null
marshmallow-code/webargs
from unittest import mock import pytest from flask import Flask from marshmallow import Schema from werkzeug.exceptions import BadRequest, HTTPException from webargs import ValidationError, fields, missing from webargs.core import json from webargs.flaskparser import abort, parser from webargs.testing import CommonTe...
{"val": 42}
assert
collection
tests/test_flaskparser.py
test_use_args_on_a_method_view
TestFlaskParser
35
null
marshmallow-code/webargs
from unittest import mock from urllib.parse import urlencode import marshmallow as ma import pytest import tornado.concurrent import tornado.http1connection import tornado.httpserver import tornado.httputil import tornado.ioloop import tornado.testing import tornado.web from webargs import fields, missing, validate f...
{}
assert
collection
tests/test_tornadoparser.py
test_it_should_not_include_fieldnames_if_not_present
TestJSONArgs
140
null
marshmallow-code/webargs
import collections import datetime import typing from unittest import mock import pytest from bottle import MultiDict as BotMultiDict from django.utils.datastructures import MultiValueDict as DjMultiDict from marshmallow import ( EXCLUDE, INCLUDE, RAISE, Schema, missing, pre_load, validates...
""
assert
string_literal
tests/test_core.py
test_delimited_list_empty_string
947
null
marshmallow-code/webargs
import pytest import webtest from webargs.core import json class CommonTestCase: def create_app(self): """Return a WSGI app""" raise NotImplementedError("Must define create_app()") def create_testapp(self, app): return webtest.TestApp(app) def before_create_app(self): pa...
400
assert
numeric_literal
src/webargs/testing.py
test_parse_json_with_nonutf8_chars
CommonTestCase
161
null
marshmallow-code/webargs
import collections import datetime import typing from unittest import mock import pytest from bottle import MultiDict as BotMultiDict from django.utils.datastructures import MultiValueDict as DjMultiDict from marshmallow import ( EXCLUDE, INCLUDE, RAISE, Schema, missing, pre_load, validates...
[]
assert
collection
tests/test_core.py
test_delimited_list_empty_string
944
null
marshmallow-code/webargs
import asyncio from io import BytesIO from unittest import mock import pytest import webtest import webtest_aiohttp from tests.apps.aiohttp_app import create_app from webargs import fields from webargs.aiohttpparser import AIOHTTPParser from webargs.testing import CommonTestCase def web_request(): req = mock.Moc...
CustomError)
pytest.raises
variable
tests/test_aiohttpparser.py
test_aiohttpparser_synchronous_error_handler
99
null
marshmallow-code/webargs
from webargs.testing import CommonTestCase class TestPyramidParser(CommonTestCase): def create_app(self): from .apps.pyramid_app import create_app return create_app() def test_parse_matchdict(self, testapp): assert testapp.get("/echo_matchdict/42").json ==
{"mymatch": 42}
assert
collection
tests/test_pyramidparser.py
test_parse_matchdict
TestPyramidParser
14
null
marshmallow-code/webargs
import falcon.testing import pytest from tests.apps.falcon_app import create_app, create_async_app from webargs.testing import CommonTestCase class TestFalconParser(CommonTestCase): def create_app(self): return create_app() def test_parse_media_error_unexpected_int(self, testapp): res = testa...
422
assert
numeric_literal
tests/test_falconparser.py
test_parse_media_error_unexpected_int
TestFalconParser
32
null
marshmallow-code/webargs
import falcon.testing import pytest from tests.apps.falcon_app import create_app, create_async_app from webargs.testing import CommonTestCase class TestFalconParser(CommonTestCase): def create_app(self): return create_app() def test_use_args_hook(self, testapp): assert testapp.get("/echo_use...
{"name": "Fred"}
assert
collection
tests/test_falconparser.py
test_use_args_hook
TestFalconParser
17
null
marshmallow-code/webargs
import pytest import webtest from webargs.core import json class CommonTestCase: def create_app(self): """Return a WSGI app""" raise NotImplementedError("Must define create_app()") def create_testapp(self, app): return webtest.TestApp(app) def before_create_app(self): pa...
expected
assert
variable
src/webargs/testing.py
test_parse_querystring_multiple
CommonTestCase
119
null
marshmallow-code/webargs
from unittest import mock from urllib.parse import urlencode import marshmallow as ma import pytest import tornado.concurrent import tornado.http1connection import tornado.httpserver import tornado.httputil import tornado.ioloop import tornado.testing import tornado.web from webargs import fields, missing, validate f...
[2]
assert
collection
tests/test_tornadoparser.py
test_it_should_parse_cookies_arguments
TestParse
278
null
marshmallow-code/webargs
import pytest import webtest from webargs.core import json class CommonTestCase: def create_app(self): """Return a WSGI app""" raise NotImplementedError("Must define create_app()") def create_testapp(self, app): return webtest.TestApp(app) def before_create_app(self): pa...
422
assert
numeric_literal
src/webargs/testing.py
test_parse_json_error_unexpected_int
CommonTestCase
92
null
marshmallow-code/webargs
from unittest import mock from urllib.parse import urlencode import marshmallow as ma import pytest import tornado.concurrent import tornado.http1connection import tornado.httpserver import tornado.httputil import tornado.ioloop import tornado.testing import tornado.web from webargs import fields, missing, validate f...
()
assert
collection
tests/test_tornadoparser.py
get
Handler
331
null
marshmallow-code/webargs
from unittest import mock from urllib.parse import urlencode import marshmallow as ma import pytest import tornado.concurrent import tornado.http1connection import tornado.httpserver import tornado.httputil import tornado.ioloop import tornado.testing import tornado.web from webargs import fields, missing, validate f...
value
assert
variable
tests/test_tornadoparser.py
test_it_should_parse_query_arguments
TestParse
222
null
marshmallow-code/webargs
from webargs.testing import CommonTestCase class TestPyramidParser(CommonTestCase): def create_app(self): from .apps.pyramid_app import create_app return create_app() def test_use_args_with_callable_view(self, testapp): assert testapp.get("/echo_callable?value=42").json ==
{"value": 42}
assert
collection
tests/test_pyramidparser.py
test_use_args_with_callable_view
TestPyramidParser
11
null
marshmallow-code/webargs
import pytest import webtest from webargs.core import json class CommonTestCase: def create_app(self): """Return a WSGI app""" raise NotImplementedError("Must define create_app()") def create_testapp(self, app): return webtest.TestApp(app) def before_create_app(self): pa...
{}
assert
collection
src/webargs/testing.py
test_parse_nested_many_missing
CommonTestCase
220
null
marshmallow-code/webargs
import asyncio from io import BytesIO from unittest import mock import pytest import webtest import webtest_aiohttp from tests.apps.aiohttp_app import create_app from webargs import fields from webargs.aiohttpparser import AIOHTTPParser from webargs.testing import CommonTestCase def web_request(): req = mock.Moc...
{"mymatch": 42}
assert
collection
tests/test_aiohttpparser.py
test_parse_match_info
TestAIOHTTPParser
39
null
marshmallow-code/webargs
import falcon.testing import pytest from tests.apps.falcon_app import create_app, create_async_app from webargs.testing import CommonTestCase class TestFalconParser(CommonTestCase): def create_app(self): return create_app() def test_parse_media_missing(self, testapp): assert testapp.post("/e...
{"name": "World"}
assert
collection
tests/test_falconparser.py
test_parse_media_missing
TestFalconParser
25
null
marshmallow-code/webargs
from unittest import mock import pytest from flask import Flask from marshmallow import Schema from werkzeug.exceptions import BadRequest, HTTPException from webargs import ValidationError, fields, missing from webargs.core import json from webargs.flaskparser import abort, parser from webargs.testing import CommonTe...
HTTPException)
pytest.raises
variable
tests/test_flaskparser.py
test_abort_called_on_validation_error
146
null
marshmallow-code/webargs
import collections import datetime import typing from unittest import mock import pytest from bottle import MultiDict as BotMultiDict from django.utils.datastructures import MultiValueDict as DjMultiDict from marshmallow import ( EXCLUDE, INCLUDE, RAISE, Schema, missing, pre_load, validates...
0
assert
numeric_literal
tests/test_core.py
test_handle_error_called_when_parsing_raises_error
342
null
marshmallow-code/webargs
import marshmallow as ma from flask import Flask, Response, request from flask import jsonify as J from flask.views import MethodView from webargs import fields, validate from webargs.core import json from webargs.flaskparser import ( parser, use_args, use_kwargs, ) def echo(): return J(parser.parse(h...
kwargs
assert
variable
tests/apps/flask_app.py
echo_use_kwargs_missing
262
null
marshmallow-code/webargs
import asyncio from io import BytesIO from unittest import mock import pytest import webtest import webtest_aiohttp from tests.apps.aiohttp_app import create_app from webargs import fields from webargs.aiohttpparser import AIOHTTPParser from webargs.testing import CommonTestCase def web_request(): req = mock.Moc...
{}
assert
collection
tests/test_aiohttpparser.py
test_nested_many_with_data_key
TestAIOHTTPParser
58
null
marshmallow-code/webargs
import collections import datetime import typing from unittest import mock import pytest from bottle import MultiDict as BotMultiDict from django.utils.datastructures import MultiValueDict as DjMultiDict from marshmallow import ( EXCLUDE, INCLUDE, RAISE, Schema, missing, pre_load, validates...
2
assert
numeric_literal
tests/test_core.py
test_handle_error_called_when_parsing_raises_error
348
null
marshmallow-code/webargs
import asyncio from io import BytesIO from unittest import mock import pytest import webtest import webtest_aiohttp from tests.apps.aiohttp_app import create_app from webargs import fields from webargs.aiohttpparser import AIOHTTPParser from webargs.testing import CommonTestCase def web_request(): req = mock.Moc...
{"name": "Steve"}
assert
collection
tests/test_aiohttpparser.py
test_use_args_on_method_handler
TestAIOHTTPParser
43
null
marshmallow-code/webargs
from unittest import mock from urllib.parse import urlencode import marshmallow as ma import pytest import tornado.concurrent import tornado.http1connection import tornado.httpserver import tornado.httputil import tornado.ioloop import tornado.testing import tornado.web from webargs import fields, missing, validate f...
400
assert
numeric_literal
tests/test_tornadoparser.py
test_it_should_raise_when_json_is_invalid
TestParse
255
null
marshmallow-code/webargs
import pytest import webtest from webargs.core import json class CommonTestCase: def create_app(self): """Return a WSGI app""" raise NotImplementedError("Must define create_app()") def create_testapp(self, app): return webtest.TestApp(app) def before_create_app(self): pa...
{"value": 42}
assert
collection
src/webargs/testing.py
test_use_args_with_path_param
CommonTestCase
178
null
marshmallow-code/webargs
import asyncio from io import BytesIO from unittest import mock import pytest import webtest import webtest_aiohttp from tests.apps.aiohttp_app import create_app from webargs import fields from webargs.aiohttpparser import AIOHTTPParser from webargs.testing import CommonTestCase def web_request(): req = mock.Moc...
{"first": "1", "last": "2"}
assert
collection
tests/test_aiohttpparser.py
test_multiple_args
TestAIOHTTPParser
50
null
marshmallow-code/webargs
import asyncio from io import BytesIO from unittest import mock import pytest import webtest import webtest_aiohttp from tests.apps.aiohttp_app import create_app from webargs import fields from webargs.aiohttpparser import AIOHTTPParser from webargs.testing import CommonTestCase def web_request(): req = mock.Moc...
{ "query_parsed": {"page": 2, "q": 10}, "json_parsed": {"name": "Steve"}, }
assert
collection
tests/test_aiohttpparser.py
test_use_args_multiple
TestAIOHTTPParser
77
null
marshmallow-code/webargs
import asyncio from io import BytesIO from unittest import mock import pytest import webtest import webtest_aiohttp from tests.apps.aiohttp_app import create_app from webargs import fields from webargs.aiohttpparser import AIOHTTPParser from webargs.testing import CommonTestCase def web_request(): req = mock.Moc...
{ "name": "Chandler" }
assert
collection
tests/test_aiohttpparser.py
test_schema_as_kwargs_view
TestAIOHTTPParser
62
null
marshmallow-code/webargs
from unittest import mock from urllib.parse import urlencode import marshmallow as ma import pytest import tornado.concurrent import tornado.http1connection import tornado.httpserver import tornado.httputil import tornado.ioloop import tornado.testing import tornado.web from webargs import fields, missing, validate f...
[1, 2]
assert
collection
tests/test_tornadoparser.py
test_it_should_parse_query_arguments
TestParse
221
null
marshmallow-code/webargs
import falcon.testing import pytest from tests.apps.falcon_app import create_app, create_async_app from webargs.testing import CommonTestCase class TestFalconParser(CommonTestCase): def create_app(self): return create_app() @pytest.mark.parametrize("path", ["/echo_json", "/echo_media"]) def test_...
{"json": ["Invalid JSON body."]}
assert
collection
tests/test_falconparser.py
test_parse_json_with_nonutf8_chars
TestFalconParser
46
null
dedupeio/dedupe
import unittest from dedupe import predicates class TestAlpaNumeric(unittest.TestCase): def test_alphanumeric(self): assert predicates.alphaNumericPredicate("a1") == {"a1"} assert predicates.alphaNumericPredicate("1a") == {"1a"} assert predicates.alphaNumericPredicate("a1b") == {"a1b"} ...
{"1"}
assert
collection
tests/test_predicates.py
test_alphanumeric
TestAlpaNumeric
74
null
dedupeio/dedupe
import unittest from dedupe import predicates class TestSetElement(unittest.TestCase): def setUp(self): self.s1 = {"red", "blue", "green"} def test_empty_set(self): block_val = predicates.commonSetElementPredicate(set()) self.assertEqual(block_val,
set())
self.assertEqual
func_call
tests/test_predicates.py
test_empty_set
TestSetElement
42
null
dedupeio/dedupe
import unittest import dedupe import dedupe.branch_and_bound as branch_and_bound import dedupe.training as training class TrainingTest(unittest.TestCase): def setUp(self): field_definition = [dedupe.variables.String("name")] self.data_model = dedupe.Dedupe(field_definition).data_model self...
before
assert
variable
tests/test_training.py
test_uncovered_by
TrainingTest
67
null
dedupeio/dedupe
import unittest import dedupe class ParsingTest(unittest.TestCase): def setUp(self): self.index = dedupe.tfidf.TfIdfIndex() def test_empty_search(self): self.index._index.initSearch() assert self.index.search(()) ==
[]
assert
collection
tests/test_tfidf.py
test_empty_search
ParsingTest
22
null
dedupeio/dedupe
import unittest from dedupe.cpredicates import initials, ngrams, unique_ngrams class TestCPredicates(unittest.TestCase): def test_unique_ngrams(self): assert unique_ngrams("mississippi", 1) ==
{"m", "i", "s", "p"}
assert
collection
tests/test_cpredicates.py
test_unique_ngrams
TestCPredicates
91
null
dedupeio/dedupe
import unittest from dedupe.cpredicates import initials, ngrams, unique_ngrams class TestCPredicates(unittest.TestCase): def test_initials(self): assert initials("deduplicate", 1) == {"d"} assert initials("deduplicate", 2) == {"de"} assert initials("deduplicate", 3) == {"ded"} as...
{"dedu"}
assert
collection
tests/test_cpredicates.py
test_initials
TestCPredicates
163
null
dedupeio/dedupe
import itertools import unittest import numpy import dedupe import dedupe.variables DATA = { 100: {"name": "Bob", "age": "50"}, 105: {"name": "Charlie", "age": "75"}, 110: {"name": "Meredith", "age": "40"}, 115: {"name": "Sue", "age": "10"}, 120: {"name": "Jimmy", "age": "20"}, 125: {"name": ...
[]
assert
collection
tests/test_dedupe.py
test_data_model
DataModelTest
65
null
dedupeio/dedupe
import unittest import dedupe class ParsingTest(unittest.TestCase): def setUp(self): self.index = dedupe.tfidf.TfIdfIndex() def test_keywords(self): self.index.index(("AND", "OR", "EOF", "NOT")) self.index._index.initSearch() assert self.index.search(("AND", "OR", "EOF", "NOT...
1
assert
numeric_literal
tests/test_tfidf.py
test_keywords
ParsingTest
13
null
dedupeio/dedupe
import random import unittest import numpy import scipy.special import dedupe class ScoreDuplicates(unittest.TestCase): def setUp(self): random.seed(123) long_string = "asa;sasdfjasdio;fio;asdnfasdvnvao;asduifvnavjasdfasdfasfasasdfasdfasdfasdfasdfsdfasgnuavpidcvaspdivnaspdivninasduinguipghauipsd...
2)
assert_*
numeric_literal
tests/test_core.py
test_score_duplicates_with_zeros
ScoreDuplicates
102
null
dedupeio/dedupe
import itertools import unittest import numpy import dedupe import dedupe.variables DATA = { 100: {"name": "Bob", "age": "50"}, 105: {"name": "Charlie", "age": "75"}, 110: {"name": "Meredith", "age": "40"}, 115: {"name": "Sue", "age": "10"}, 120: {"name": "Jimmy", "age": "20"}, 125: {"name": ...
{ frozenset(((1, 2), (2, 3))), frozenset(((4, 5), (4, 6))), frozenset(((12, 13), (12, 14), (10, 11), (11, 12))), frozenset(((7, 9), (8, 9))), }
assert
collection
tests/test_dedupe.py
test_components
ConnectedComponentsTest
90
null
dedupeio/dedupe
import unittest from dedupe import predicates class TestSetElement(unittest.TestCase): def setUp(self): self.s1 = {"red", "blue", "green"} def test_magnitude(self): block_val = predicates.magnitudeOfCardinality(self.s1) assert block_val == {"0"} block_val = predicates.magnitu...
set()
assert
func_call
tests/test_predicates.py
test_magnitude
TestSetElement
55
null
dedupeio/dedupe
import unittest from dedupe import predicate_functions as fn from dedupe.cpredicates import ngrams class TestPredicateFunctions(unittest.TestCase): def test_first_token_predicate(self): assert fn.firstTokenPredicate("donald") == {"donald"} assert fn.firstTokenPredicate("don ald") == {"don"} ...
{"do"}
assert
collection
tests/test_predicate_functions.py
test_first_token_predicate
TestPredicateFunctions
22
null
dedupeio/dedupe
import unittest from dedupe import predicates class TestNumericPredicates(unittest.TestCase): def test_round_to_1(self): assert predicates.roundTo1(22315) == {"20000"} assert predicates.roundTo1(-22315) ==
{"-20000"}
assert
collection
tests/test_predicates.py
test_round_to_1
TestNumericPredicates
97
null
dedupeio/dedupe
import unittest from collections import defaultdict import dedupe class TfIndexUnindex(unittest.TestCase): def setUp(self): data_d = { 100: {"name": "Bob", "age": "50", "dataset": 0}, 105: {"name": "Charlie", "age": "75", "dataset": 1}, 110: {"name": "Meredith", "age": ...
1
assert
numeric_literal
tests/test_blocking.py
test_doubled_index
TfIndexUnindex
117
null
dedupeio/dedupe
import unittest from dedupe import predicates class TestCompoundPredicate(unittest.TestCase): def test_escapes_colon(self): """ Regression test for issue #836 """ predicate_1 = predicates.SimplePredicate( predicates.commonSetElementPredicate, "col_1" ) p...
4
assert
numeric_literal
tests/test_predicates.py
test_escapes_colon
TestCompoundPredicate
114
null
dedupeio/dedupe
import unittest import dedupe import dedupe.branch_and_bound as branch_and_bound import dedupe.training as training class TrainingTest(unittest.TestCase): def setUp(self): field_definition = [dedupe.variables.String("name")] self.data_model = dedupe.Dedupe(field_definition).data_model self...
{0, 1}
assert
collection
tests/test_training.py
test_covered_pairs
TrainingTest
77
null
dedupeio/dedupe
import unittest from dedupe import predicate_functions as fn from dedupe.cpredicates import ngrams class TestPredicateFunctions(unittest.TestCase): def test_first_token_predicate(self): assert fn.firstTokenPredicate("donald") == {"donald"} assert fn.firstTokenPredicate("don ald") ==
{"don"}
assert
collection
tests/test_predicate_functions.py
test_first_token_predicate
TestPredicateFunctions
21
null
dedupeio/dedupe
import unittest from collections import defaultdict import dedupe class TfIndexUnindex(unittest.TestCase): def setUp(self): data_d = { 100: {"name": "Bob", "age": "50", "dataset": 0}, 105: {"name": "Charlie", "age": "75", "dataset": 1}, 110: {"name": "Meredith", "age": ...
0
assert
numeric_literal
tests/test_blocking.py
test_unindex
TfIndexUnindex
130
null
dedupeio/dedupe
import unittest import dedupe.canonical class CanonicalizationTest(unittest.TestCase): def test_get_canonical_rep(self): record_list = [ {"name": "mary crane", "address": "123 main st", "zip": "12345"}, {"name": "mary crane east", "address": "123 main street", "zip": ""}, ...
{"name": "mary crane", "address": "123 main st", "zip": "12345"}
assert
collection
tests/test_canonical.py
test_get_canonical_rep
CanonicalizationTest
55
null
dedupeio/dedupe
import unittest from dedupe import predicate_functions as fn from dedupe.cpredicates import ngrams class TestPredicateFunctions(unittest.TestCase): def test_common_integer_predicate(self): assert fn.commonIntegerPredicate("don4ld") ==
{"4"}
assert
collection
tests/test_predicate_functions.py
test_common_integer_predicate
TestPredicateFunctions
34
null
dedupeio/dedupe
import unittest from dedupe.cpredicates import initials, ngrams, unique_ngrams class TestCPredicates(unittest.TestCase): def test_unique_ngrams(self): assert unique_ngrams("mississippi", 1) == {"m", "i", "s", "p"} assert unique_ngrams("mississippi", 2) == { "mi", "is", ...
{"mississippi"}
assert
collection
tests/test_cpredicates.py
test_unique_ngrams
TestCPredicates
155
null
dedupeio/dedupe
import itertools import unittest import numpy import dedupe import dedupe.variables DATA = { 100: {"name": "Bob", "age": "50"}, 105: {"name": "Charlie", "age": "75"}, 110: {"name": "Meredith", "age": "40"}, 115: {"name": "Sue", "age": "10"}, 120: {"name": "Jimmy", "age": "20"}, 125: {"name": ...
target
assert
variable
tests/test_dedupe.py
test_gazette_matching
ClusteringTest
231
null
dedupeio/dedupe
import itertools import unittest import warnings from collections import OrderedDict import dedupe.api def icfi(x): return list(itertools.chain.from_iterable(x)) class ActiveMatch(unittest.TestCase): def setUp(self): self.field_definition = [ dedupe.variables.String("name"), d...
"Didn't return any labeled record pairs"
assert
string_literal
tests/test_api.py
test_markPair
ActiveMatch
114
null
dedupeio/dedupe
import codecs import json import sys import unittest import dedupe class SerializerTest(unittest.TestCase): def test_writeTraining(self): if sys.version < "3": from StringIO import StringIO output = StringIO() encoded_file = codecs.EncodedFile( output, ...
dict( training_pairs["distinct"][0][0] )
assert
func_call
tests/test_serializer.py
test_writeTraining
SerializerTest
46
null
dedupeio/dedupe
import unittest from dedupe import predicate_functions as fn from dedupe.cpredicates import ngrams class TestPredicateFunctions(unittest.TestCase): def test_magnitude_of_cardinality(self): assert fn.magnitudeOfCardinality(range(0)) == frozenset() assert fn.magnitudeOfCardinality(range(98)) == {"2...
{"6"}
assert
collection
tests/test_predicate_functions.py
test_magnitude_of_cardinality
TestPredicateFunctions
235
null
dedupeio/dedupe
import codecs import json import sys import unittest import dedupe class SerializerTest(unittest.TestCase): def test_writeTraining(self): if sys.version < "3": from StringIO import StringIO output = StringIO() encoded_file = codecs.EncodedFile( output, ...
training_pairs
assert
variable
tests/test_serializer.py
test_writeTraining
SerializerTest
61
null
dedupeio/dedupe
import random import unittest import pytest import dedupe from dedupe import datamodel, labeler from dedupe._typing import RecordDictPair SAMPLE = { 1: {"name": "Meredith", "age": "40"}, 2: {"name": "Sue", "age": "10"}, 3: {"name": "Willy", "age": "35"}, 4: {"name": "William", "age": "35"}, 5: {"...
EXPECTED_CANDIDATES
assert
variable
tests/test_labeler.py
test_AL
ActiveLearningTest
55
null
dedupeio/dedupe
import unittest from dedupe.cpredicates import initials, ngrams, unique_ngrams class TestCPredicates(unittest.TestCase): def test_initials(self): assert initials("deduplicate", 1) == {"d"} assert initials("deduplicate", 2) == {"de"} assert initials("deduplicate", 3) == {"ded"} ass...
{"dedup"}
assert
collection
tests/test_cpredicates.py
test_initials
TestCPredicates
164
null
dedupeio/dedupe
import unittest from dedupe import predicate_functions as fn from dedupe.cpredicates import ngrams class TestPredicateFunctions(unittest.TestCase): def test_first_integer_predicate(self): assert fn.firstIntegerPredicate("donald 456") == frozenset() assert fn.firstIntegerPredicate("1992 donald") =...
{"111"}
assert
collection
tests/test_predicate_functions.py
test_first_integer_predicate
TestPredicateFunctions
74
null
dedupeio/dedupe
import unittest import dedupe import dedupe.branch_and_bound as branch_and_bound import dedupe.training as training class TrainingTest(unittest.TestCase): def setUp(self): field_definition = [dedupe.variables.String("name")] self.data_model = dedupe.Dedupe(field_definition).data_model self...
after
assert
variable
tests/test_training.py
test_uncovered_by
TrainingTest
68
null