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 |
|---|---|---|---|---|---|---|---|---|---|
pajbot/pajbot | def test_find_iterate():
from pajbot.utils import find
d = {
"foo": True,
"bar": True,
"xD": False,
}
haystack = ["foo", "baz", "bar"]
for k, v in d.items():
needle = find(lambda t: t == k, haystack)
if v:
assert needle == | k | assert | variable | pajbot/tests/test_find.py | test_find_iterate | 15 | null | |
pajbot/pajbot | from pajbot.modules.bingo import join_to_sentence
def test_custom_separators():
assert join_to_sentence(["asd", "def", "KKona", "xD"], ";", " et ") == | "asd;def;KKona et xD" | assert | string_literal | pajbot/tests/modules/test_join_to_sentence.py | test_custom_separators | 25 | null | |
pajbot/pajbot | def test_clean_up() -> None:
from pajbot.utils import clean_up_message
assert "" == "\U | "\U000e0000" | assert | string_literal | pajbot/tests/test_clean_up_message.py | test_clean_up | 4 | null | |
pajbot/pajbot | from pajbot.utils import iterate_split_with_index
import pytest
def test_empty_item() -> None:
# a bcd ef
generator = iterate_split_with_index(["a", "", "ef"])
assert next(generator) == (0, "a")
assert next(generator) == | (2, "") | assert | collection | pajbot/tests/test_iterate_split_with_index.py | test_empty_item | 20 | null | |
pajbot/pajbot | from pajbot.utils import iterate_split_with_index
import pytest
def test_empty_item() -> None:
# a bcd ef
generator = iterate_split_with_index(["a", "", "ef"])
assert next(generator) == (0, "a")
assert next(generator) == (2, "")
assert next(generator) == | (3, "ef") | assert | collection | pajbot/tests/test_iterate_split_with_index.py | test_empty_item | 21 | null | |
pajbot/pajbot | from pajbot.utils import iterate_split_with_index
import pytest
def test_iterates_correctly() -> None:
# a bcd ef
generator = iterate_split_with_index(["a", "bcd", "ef"])
assert next(generator) == (0, "a")
assert next(generator) == (2, "bcd")
assert next(generator) == | (6, "ef") | assert | collection | pajbot/tests/test_iterate_split_with_index.py | test_iterates_correctly | 11 | null | |
pajbot/pajbot | from pajbot.modules.trivia import TriviaModule
import pytest
def get_valid_cases() -> list[tuple[tuple[str, str], bool]]:
# (user_answer, correct_answer)
return [
(("foo", "foo"), True),
(("fooba", "fooab"), False),
# Incorrect but close enough
(("the eifel tower", "the eiffel ... | AssertionError) | pytest.raises | variable | pajbot/tests/modules/test_trivia_confirm_answer.py | test_trivia_confirm_answer_errors | 38 | null | |
pajbot/pajbot | from pajbot.apiwrappers.base import BaseAPI
def test_does_not_change_non_relative_urls():
assert BaseAPI.fill_in_url_scheme("http://example.com") == | "http://example.com" | assert | string_literal | pajbot/tests/apiwrappers/test_fill_in_url_scheme.py | test_does_not_change_non_relative_urls | 13 | null | |
stac-utils/stac-fastapi | from fastapi import Depends, HTTPException, security, status
from starlette.testclient import TestClient
from stac_fastapi.api.app import StacApi
from stac_fastapi.api.models import ItemCollectionUri, create_request_model
from stac_fastapi.extensions.core import TokenPaginationExtension, TransactionExtension
from stac... | "application/vnd.oai.openapi+json;version=3.0" | assert | string_literal | stac_fastapi/api/tests/test_api.py | test_openapi_content_type | TestRouteDependencies | 84 | null |
stac-utils/stac-fastapi | import urllib
from typing import Optional
import pytest
from fastapi import APIRouter
from starlette.testclient import TestClient
from stac_fastapi.api.app import StacApi
from stac_fastapi.types.config import ApiSettings
def get_link(landing_page, rel_type, method: Optional[str] = None):
return next(
fil... | "0.1.0dev" | assert | string_literal | stac_fastapi/api/tests/test_app_prefix.py | test_api_fastapi_option | 243 | null | |
stac-utils/stac-fastapi | import json
import pytest
from fastapi import Depends, FastAPI, HTTPException
from fastapi.testclient import TestClient
from pydantic import BaseModel, ValidationError
from stac_fastapi.api.models import create_get_request_model, create_post_request_model
from stac_fastapi.extensions.core import FieldsExtension, Filt... | "test=test" | assert | string_literal | stac_fastapi/api/tests/test_models.py | test_create_get_request_model | 91 | null | |
stac-utils/stac-fastapi | from typing import Iterator
import pytest
from fastapi import APIRouter
from starlette.testclient import TestClient
from stac_fastapi.api.app import StacApi
from stac_fastapi.api.models import create_get_request_model, create_post_request_model
from stac_fastapi.extensions.core import FilterExtension
from stac_fastap... | "cql2-json" | assert | string_literal | stac_fastapi/extensions/tests/test_filter.py | test_search_filter_post_filter_lang_default | 122 | null | |
stac-utils/stac-fastapi | import json
from typing import Iterator, List, Union
import pytest
from stac_pydantic import Collection
from stac_pydantic.item import Item
from stac_pydantic.item_collection import ItemCollection
from starlette.testclient import TestClient
from stac_fastapi.api.app import StacApi
from stac_fastapi.extensions.core im... | "a-collection" | assert | string_literal | stac_fastapi/extensions/tests/test_transaction.py | test_update_item | 122 | null | |
stac-utils/stac-fastapi | from datetime import datetime, timezone
import pytest
from fastapi import HTTPException
from stac_fastapi.types.rfc3339 import (
now_in_utc,
now_to_rfc3339_str,
rfc3339_str_to_datetime,
str_to_interval,
)
invalid_datetimes = [
"1985-04-12", # date only
"1937-01-01T12:00:27.87+0100", # inval... | 400 | assert | numeric_literal | stac_fastapi/types/tests/test_rfc3339.py | test_str_to_interval_with_invalid_interval | 92 | null | |
stac-utils/stac-fastapi | from unittest import mock
import pytest
from fastapi import Request
from fastapi.responses import JSONResponse
from starlette.applications import Starlette
from starlette.testclient import TestClient
from stac_fastapi.api.app import StacApi
from stac_fastapi.api.middleware import ProxyHeaderMiddleware
from stac_fasta... | 200 | assert | numeric_literal | stac_fastapi/api/tests/test_middleware.py | test_cors_middleware | 290 | null | |
stac-utils/stac-fastapi | import pytest
from fastapi import Depends, FastAPI
from fastapi.testclient import TestClient
from pydantic import ValidationError
from stac_fastapi.types.search import BaseSearchGetRequest, BaseSearchPostRequest
def test_limit_get_request():
"""test GET model."""
app = FastAPI()
@app.get("/test")
de... | 200 | assert | numeric_literal | stac_fastapi/types/tests/test_limit.py | test_limit_get_request | 43 | null | |
stac-utils/stac-fastapi | from fastapi import Depends, HTTPException, security, status
from starlette.testclient import TestClient
from stac_fastapi.api.app import StacApi
from stac_fastapi.api.models import ItemCollectionUri, create_request_model
from stac_fastapi.extensions.core import TokenPaginationExtension, TransactionExtension
from stac... | {"detail": "Not authenticated"} | assert | collection | stac_fastapi/api/tests/test_api.py | _assert_dependency_applied | TestRouteDependencies | 45 | null |
stac-utils/stac-fastapi | import json
import pytest
from fastapi import Depends, FastAPI, HTTPException
from fastapi.testclient import TestClient
from pydantic import BaseModel, ValidationError
from stac_fastapi.api.models import create_get_request_model, create_post_request_model
from stac_fastapi.extensions.core import FieldsExtension, Filt... | filter_val | assert | variable | stac_fastapi/api/tests/test_models.py | test_create_post_request_model | 125 | null | |
stac-utils/stac-fastapi | from datetime import datetime, timezone
import pytest
from fastapi import HTTPException
from stac_fastapi.types.rfc3339 import (
now_in_utc,
now_to_rfc3339_str,
rfc3339_str_to_datetime,
str_to_interval,
)
invalid_datetimes = [
"1985-04-12", # date only
"1937-01-01T12:00:27.87+0100", # inval... | timezone.utc | assert | complex_expr | stac_fastapi/types/tests/test_rfc3339.py | test_now_functions | 132 | null | |
stac-utils/stac-fastapi | from starlette.testclient import TestClient
from stac_fastapi.api.app import StacApi
from stac_fastapi.api.models import (
ItemCollectionUri,
create_get_request_model,
create_post_request_model,
create_request_model,
)
from stac_fastapi.extensions.core import FreeTextAdvancedExtension, FreeTextExtensio... | conforms | assert | variable | stac_fastapi/extensions/tests/test_free_text.py | test_search_free_text_search | 59 | null | |
stac-utils/stac-fastapi | from typing import Iterator
import pytest
from fastapi import Depends, FastAPI
from starlette.testclient import TestClient
from stac_fastapi.api.app import StacApi
from stac_fastapi.extensions.core import AggregationExtension
from stac_fastapi.extensions.core.aggregation.client import BaseAggregationClient
from stac_... | 200 | assert | numeric_literal | stac_fastapi/extensions/tests/test_aggregation.py | test_landing | 97 | null | |
stac-utils/stac-fastapi | import json
import pytest
from fastapi import Depends, FastAPI, HTTPException
from fastapi.testclient import TestClient
from pydantic import BaseModel, ValidationError
from stac_fastapi.api.models import create_get_request_model, create_post_request_model
from stac_fastapi.extensions.core import FieldsExtension, Filt... | ValidationError) | pytest.raises | variable | stac_fastapi/api/tests/test_models.py | test_create_post_request_model | 129 | null | |
stac-utils/stac-fastapi | import json
from typing import Iterator, List, Union
import pytest
from stac_pydantic import Collection
from stac_pydantic.item import Item
from stac_pydantic.item_collection import ItemCollection
from starlette.testclient import TestClient
from stac_fastapi.api.app import StacApi
from stac_fastapi.extensions.core im... | "FeatureCollection" | assert | string_literal | stac_fastapi/extensions/tests/test_transaction.py | test_create_item_collection | 114 | null | |
stac-utils/stac-fastapi | from fastapi import Depends, HTTPException, security, status
from starlette.testclient import TestClient
from stac_fastapi.api.app import StacApi
from stac_fastapi.api.models import ItemCollectionUri, create_request_model
from stac_fastapi.extensions.core import TokenPaginationExtension, TransactionExtension
from stac... | response.status_code | assert | complex_expr | stac_fastapi/api/tests/test_api.py | _assert_dependency_applied | TestRouteDependencies | 57 | null |
stac-utils/stac-fastapi | import json
from datetime import datetime, timezone
from urllib.parse import quote_plus
import attr
import pytest
from starlette.testclient import TestClient
from stac_fastapi.api.app import StacApi
from stac_fastapi.api.models import create_request_model
from stac_fastapi.extensions.core import (
AggregationExte... | utcnow | assert | variable | stac_fastapi/extensions/tests/test_collection_search.py | test_datetime_clean | 97 | null | |
stac-utils/stac-fastapi | import pytest
from fastapi import Depends, FastAPI
from fastapi.testclient import TestClient
from pydantic import ValidationError
from stac_fastapi.types.search import BaseSearchGetRequest, BaseSearchPostRequest
def test_limit_get_request():
"""test GET model."""
app = FastAPI()
@app.get("/test")
de... | 10 | assert | numeric_literal | stac_fastapi/types/tests/test_limit.py | test_limit_get_request | 45 | null | |
stac-utils/stac-fastapi | from typing import Iterator
import pytest
from fastapi import APIRouter
from starlette.testclient import TestClient
from stac_fastapi.api.app import StacApi
from stac_fastapi.api.models import create_get_request_model, create_post_request_model
from stac_fastapi.extensions.core import FilterExtension
from stac_fastap... | 200 | assert | numeric_literal | stac_fastapi/extensions/tests/test_filter.py | test_multi_ext_prefix | 192 | null | |
stac-utils/stac-fastapi | from typing import Iterator
import pytest
from starlette.testclient import TestClient
from stac_fastapi.api.app import StacApi
from stac_fastapi.api.models import (
EmptyRequest,
create_post_request_model,
create_request_model,
)
from stac_fastapi.extensions.core import (
OffsetPaginationExtension,
... | 1 | assert | numeric_literal | stac_fastapi/extensions/tests/test_pagination.py | test_pagination_extension | 106 | null | |
stac-utils/stac-fastapi | import pytest
from pydantic import ValidationError
from stac_fastapi.types.config import ApiSettings
def test_incompatible_options():
"""test incompatible output model options."""
settings = ApiSettings(
enable_response_models=True,
enable_direct_response=False,
)
assert settings.enabl... | ValidationError) | pytest.raises | variable | stac_fastapi/types/tests/test_config.py | test_incompatible_options | 25 | null | |
stac-utils/stac-fastapi | from typing import Iterator
import pytest
from fastapi import Depends, FastAPI
from starlette.testclient import TestClient
from stac_fastapi.api.app import StacApi
from stac_fastapi.extensions.core import AggregationExtension
from stac_fastapi.extensions.core.aggregation.client import BaseAggregationClient
from stac_... | ["collection1", "collection2"] | assert | collection | stac_fastapi/extensions/tests/test_aggregation.py | test_agg_get_query | 91 | null | |
stac-utils/stac-fastapi | from typing import Iterator
import pytest
from starlette.testclient import TestClient
from stac_fastapi.api.app import StacApi
from stac_fastapi.api.models import (
EmptyRequest,
create_post_request_model,
create_request_model,
)
from stac_fastapi.extensions.core import (
OffsetPaginationExtension,
... | None | assert | none_literal | stac_fastapi/extensions/tests/test_pagination.py | test_pagination_extension | 100 | null | |
stac-utils/stac-fastapi | from datetime import datetime
from typing import List, Optional, Union
import pytest
from stac_pydantic.api.utils import link_factory
from starlette.testclient import TestClient
from stac_fastapi.api.app import StacApi
from stac_fastapi.types import stac as stac_types
from stac_fastapi.types.config import ApiSettings... | 200 | assert | numeric_literal | stac_fastapi/api/tests/benchmarks.py | test_benchmark_items | 147 | null | |
stac-utils/stac-fastapi | import json
from typing import Iterator, List, Union
import pytest
from stac_pydantic import Collection
from stac_pydantic.item import Item
from stac_pydantic.item_collection import ItemCollection
from starlette.testclient import TestClient
from stac_fastapi.api.app import StacApi
from stac_fastapi.extensions.core im... | [ {"op": "add", "path": "/properties/foo", "value": "bar"} ] | assert | collection | stac_fastapi/extensions/tests/test_transaction.py | test_patch_operation_item | 135 | null | |
stac-utils/stac-fastapi | from typing import Iterator
import pytest
from fastapi import APIRouter
from starlette.testclient import TestClient
from stac_fastapi.api.app import StacApi
from stac_fastapi.api.models import create_get_request_model, create_post_request_model
from stac_fastapi.extensions.core import FilterExtension
from stac_fastap... | "id='item_id' AND collection='collection_id'" | assert | string_literal | stac_fastapi/extensions/tests/test_filter.py | test_search_filter_get | 139 | null | |
stac-utils/stac-fastapi | from datetime import datetime, timezone
import pytest
from fastapi import HTTPException
from stac_fastapi.types.rfc3339 import (
now_in_utc,
now_to_rfc3339_str,
rfc3339_str_to_datetime,
str_to_interval,
)
invalid_datetimes = [
"1985-04-12", # date only
"1937-01-01T12:00:27.87+0100", # inval... | None | assert | none_literal | stac_fastapi/types/tests/test_rfc3339.py | test_str_to_interval_with_none | 122 | null | |
stac-utils/stac-fastapi | from typing import Iterator
import pytest
from fastapi import Depends, FastAPI
from starlette.testclient import TestClient
from stac_fastapi.api.app import StacApi
from stac_fastapi.extensions.core import AggregationExtension
from stac_fastapi.extensions.core.aggregation.client import BaseAggregationClient
from stac_... | ["prop1", "prop2"] | assert | collection | stac_fastapi/extensions/tests/test_aggregation.py | test_agg_get_query | 92 | null | |
stac-utils/stac-fastapi | import json
import pytest
from fastapi import Depends, FastAPI, HTTPException
from fastapi.testclient import TestClient
from pydantic import BaseModel, ValidationError
from stac_fastapi.api.models import create_get_request_model, create_post_request_model
from stac_fastapi.extensions.core import FieldsExtension, Filt... | "epsg:4326" | assert | string_literal | stac_fastapi/api/tests/test_models.py | test_create_get_request_model | 44 | null | |
stac-utils/stac-fastapi | import json
from datetime import datetime, timezone
from urllib.parse import quote_plus
import attr
import pytest
from starlette.testclient import TestClient
from stac_fastapi.api.app import StacApi
from stac_fastapi.api.models import create_request_model
from stac_fastapi.extensions.core import (
AggregationExte... | 10 | assert | numeric_literal | stac_fastapi/extensions/tests/test_collection_search.py | test_collection_search_extension_post_default | 277 | null | |
stac-utils/stac-fastapi | import pytest
from fastapi import Depends, FastAPI
from fastapi.testclient import TestClient
from pydantic import ValidationError
from stac_fastapi.types.search import BaseSearchGetRequest, BaseSearchPostRequest
@pytest.mark.parametrize("value", [0, -1])
def test_limit_ge(value):
with pytest.raises( | ValidationError) | pytest.raises | variable | stac_fastapi/types/tests/test_limit.py | test_limit_ge | 11 | null | |
stac-utils/stac-fastapi | from unittest import mock
import pytest
from fastapi import Request
from fastapi.responses import JSONResponse
from starlette.applications import Starlette
from starlette.testclient import TestClient
from stac_fastapi.api.app import StacApi
from stac_fastapi.api.middleware import ProxyHeaderMiddleware
from stac_fasta... | 400 | assert | numeric_literal | stac_fastapi/api/tests/test_middleware.py | test_middleware_stack | 318 | null | |
stac-utils/stac-fastapi | import urllib
from typing import Optional
import pytest
from fastapi import APIRouter
from starlette.testclient import TestClient
from stac_fastapi.api.app import StacApi
from stac_fastapi.types.config import ApiSettings
def get_link(landing_page, rel_type, method: Optional[str] = None):
return next(
fil... | 200 | assert | numeric_literal | stac_fastapi/api/tests/test_app_prefix.py | test_api_prefix | 38 | null | |
stac-utils/stac-fastapi | import json
import pytest
from fastapi import Depends, FastAPI, HTTPException
from fastapi.testclient import TestClient
from pydantic import BaseModel, ValidationError
from stac_fastapi.api.models import create_get_request_model, create_post_request_model
from stac_fastapi.extensions.core import FieldsExtension, Filt... | 200 | assert | numeric_literal | stac_fastapi/api/tests/test_models.py | test_create_get_request_model | 88 | null | |
stac-utils/stac-fastapi | import pytest
from fastapi import Depends, FastAPI
from fastapi.testclient import TestClient
from pydantic import ValidationError
from stac_fastapi.types.search import BaseSearchGetRequest, BaseSearchPostRequest
@pytest.mark.parametrize("value", [1, 10_000])
def test_limit(value):
search = BaseSearchPostRequest(l... | value | assert | variable | stac_fastapi/types/tests/test_limit.py | test_limit | 18 | null | |
stac-utils/stac-fastapi | from unittest import mock
import pytest
from fastapi import Request
from fastapi.responses import JSONResponse
from starlette.applications import Starlette
from starlette.testclient import TestClient
from stac_fastapi.api.app import StacApi
from stac_fastapi.api.middleware import ProxyHeaderMiddleware
from stac_fasta... | "yoo" | assert | string_literal | stac_fastapi/api/tests/test_middleware.py | test_middleware_stack | 319 | null | |
stac-utils/stac-fastapi | import urllib
from typing import Optional
import pytest
from fastapi import APIRouter
from starlette.testclient import TestClient
from stac_fastapi.api.app import StacApi
from stac_fastapi.types.config import ApiSettings
def get_link(landing_page, rel_type, method: Optional[str] = None):
return next(
fil... | "stac-fastapi-tests" | assert | string_literal | stac_fastapi/api/tests/test_app_prefix.py | test_api_fastapi_option | 235 | null | |
stac-utils/stac-fastapi | from datetime import datetime, timezone
import pytest
from fastapi import HTTPException
from stac_fastapi.types.rfc3339 import (
now_in_utc,
now_to_rfc3339_str,
rfc3339_str_to_datetime,
str_to_interval,
)
invalid_datetimes = [
"1985-04-12", # date only
"1937-01-01T12:00:27.87+0100", # inval... | now2 | assert | variable | stac_fastapi/types/tests/test_rfc3339.py | test_now_functions | 131 | null | |
stac-utils/stac-fastapi | from fastapi import Depends, HTTPException, security, status
from starlette.testclient import TestClient
from stac_fastapi.api.app import StacApi
from stac_fastapi.api.models import ItemCollectionUri, create_request_model
from stac_fastapi.extensions.core import TokenPaginationExtension, TransactionExtension
from stac... | "dummy response" | assert | string_literal | stac_fastapi/api/tests/test_api.py | _assert_dependency_applied | TestRouteDependencies | 60 | null |
stac-utils/stac-fastapi | import json
from datetime import datetime, timezone
from urllib.parse import quote_plus
import attr
import pytest
from starlette.testclient import TestClient
from stac_fastapi.api.app import StacApi
from stac_fastapi.api.models import create_request_model
from stac_fastapi.extensions.core import (
AggregationExte... | conforms | assert | variable | stac_fastapi/extensions/tests/test_collection_search.py | test_collection_search_extension_models | 189 | null | |
stac-utils/stac-fastapi | import json
from typing import Iterator, List, Union
import pytest
from stac_pydantic import Collection
from stac_pydantic.item import Item
from stac_pydantic.item_collection import ItemCollection
from starlette.testclient import TestClient
from stac_fastapi.api.app import StacApi
from stac_fastapi.extensions.core im... | "Collection" | assert | string_literal | stac_fastapi/extensions/tests/test_transaction.py | test_create_collection | 164 | null | |
stac-utils/stac-fastapi | from starlette.testclient import TestClient
from stac_fastapi.api.app import StacApi
from stac_fastapi.api.models import (
ItemCollectionUri,
create_get_request_model,
create_post_request_model,
create_request_model,
)
from stac_fastapi.extensions.core import FreeTextAdvancedExtension, FreeTextExtensio... | ["ocean", "coast"] | assert | collection | stac_fastapi/extensions/tests/test_free_text.py | test_search_free_text_search | 78 | null | |
stac-utils/stac-fastapi | from fastapi import Depends, HTTPException, security, status
from starlette.testclient import TestClient
from stac_fastapi.api.app import StacApi
from stac_fastapi.api.models import ItemCollectionUri, create_request_model
from stac_fastapi.extensions.core import TokenPaginationExtension, TransactionExtension
from stac... | 401 | assert | numeric_literal | stac_fastapi/api/tests/test_api.py | _assert_dependency_applied | TestRouteDependencies | 42 | null |
stac-utils/stac-fastapi | import json
import pytest
from fastapi import Depends, FastAPI, HTTPException
from fastapi.testclient import TestClient
from pydantic import BaseModel, ValidationError
from stac_fastapi.api.models import create_get_request_model, create_post_request_model
from stac_fastapi.extensions.core import FieldsExtension, Filt... | sortby | assert | variable | stac_fastapi/api/tests/test_models.py | test_create_post_request_model_nested_fields | 171 | null | |
stac-utils/stac-fastapi | import json
from typing import Iterator, List, Union
import pytest
from stac_pydantic import Collection
from stac_pydantic.item import Item
from stac_pydantic.item_collection import ItemCollection
from starlette.testclient import TestClient
from stac_fastapi.api.app import StacApi
from stac_fastapi.extensions.core im... | "an-item" | assert | string_literal | stac_fastapi/extensions/tests/test_transaction.py | test_update_item | 123 | null | |
stac-utils/stac-fastapi | from typing import Iterator
import pytest
from fastapi import APIRouter
from starlette.testclient import TestClient
from stac_fastapi.api.app import StacApi
from stac_fastapi.api.models import create_get_request_model, create_post_request_model
from stac_fastapi.extensions.core import FilterExtension
from stac_fastap... | "cql2-text" | assert | string_literal | stac_fastapi/extensions/tests/test_filter.py | test_search_filter_get | 141 | null | |
stac-utils/stac-fastapi | import json
from datetime import datetime, timezone
from urllib.parse import quote_plus
import attr
import pytest
from starlette.testclient import TestClient
from stac_fastapi.api.app import StacApi
from stac_fastapi.api.models import create_request_model
from stac_fastapi.extensions.core import (
AggregationExte... | response_dict["bbox"] | assert | complex_expr | stac_fastapi/extensions/tests/test_collection_search.py | test_collection_search_extension_default | 143 | null | |
stac-utils/stac-fastapi | from starlette.testclient import TestClient
from stac_fastapi.api.app import StacApi
from stac_fastapi.api.models import (
ItemCollectionUri,
create_get_request_model,
create_post_request_model,
create_request_model,
)
from stac_fastapi.extensions.core import FreeTextAdvancedExtension, FreeTextExtensio... | "+ocean,-coast" | assert | string_literal | stac_fastapi/extensions/tests/test_free_text.py | test_search_free_text_search_advanced | 222 | null | |
stac-utils/stac-fastapi | from datetime import datetime, timezone
import pytest
from fastapi import HTTPException
from stac_fastapi.types.rfc3339 import (
now_in_utc,
now_to_rfc3339_str,
rfc3339_str_to_datetime,
str_to_interval,
)
invalid_datetimes = [
"1985-04-12", # date only
"1937-01-01T12:00:27.87+0100", # inval... | HTTPException) | pytest.raises | variable | stac_fastapi/types/tests/test_rfc3339.py | test_str_to_interval_with_invalid_interval | 90 | null | |
stac-utils/stac-fastapi | from starlette.testclient import TestClient
from stac_fastapi.api.app import StacApi
from stac_fastapi.api.models import (
ItemCollectionUri,
create_get_request_model,
create_post_request_model,
create_request_model,
)
from stac_fastapi.extensions.core import FreeTextAdvancedExtension, FreeTextExtensio... | "ocean,coast" | assert | string_literal | stac_fastapi/extensions/tests/test_free_text.py | test_search_free_text_advanced_complete | 302 | null | |
stac-utils/stac-fastapi | import json
from datetime import datetime, timezone
from urllib.parse import quote_plus
import attr
import pytest
from starlette.testclient import TestClient
from stac_fastapi.api.app import StacApi
from stac_fastapi.api.models import create_request_model
from stac_fastapi.extensions.core import (
AggregationExte... | response_dict | assert | variable | stac_fastapi/extensions/tests/test_collection_search.py | test_collection_search_extension_default | 129 | null | |
stac-utils/stac-fastapi | import json
import pytest
from fastapi import Depends, FastAPI, HTTPException
from fastapi.testclient import TestClient
from pydantic import BaseModel, ValidationError
from stac_fastapi.api.models import create_get_request_model, create_post_request_model
from stac_fastapi.extensions.core import FieldsExtension, Filt... | None | assert | none_literal | stac_fastapi/api/tests/test_models.py | test_create_post_request_model_nested_fields | 169 | null | |
stac-utils/stac-fastapi | from unittest import mock
import pytest
from fastapi import Request
from fastapi.responses import JSONResponse
from starlette.applications import Starlette
from starlette.testclient import TestClient
from stac_fastapi.api.app import StacApi
from stac_fastapi.api.middleware import ProxyHeaderMiddleware
from stac_fasta... | "*" | assert | string_literal | stac_fastapi/api/tests/test_middleware.py | test_cors_middleware | 291 | null | |
stac-utils/stac-fastapi | import json
import pytest
from fastapi import Depends, FastAPI, HTTPException
from fastapi.testclient import TestClient
from pydantic import BaseModel, ValidationError
from stac_fastapi.api.models import create_get_request_model, create_post_request_model
from stac_fastapi.extensions.core import FieldsExtension, Filt... | type | assert | variable | stac_fastapi/api/tests/test_models.py | test_create_get_request_model | 22 | null | |
stac-utils/stac-fastapi | import asyncio
from typing import List, Optional, Union
import attr
import pytest
from fastapi import Path, Query
from fastapi.testclient import TestClient
from pydantic import ValidationError
from stac_pydantic import api
from starlette.requests import Request
from typing_extensions import Annotated
from stac_fastap... | 200 | assert | numeric_literal | stac_fastapi/api/tests/test_app.py | test_client_response_type | 61 | null | |
stac-utils/stac-fastapi | from unittest import mock
import pytest
from fastapi import Request
from fastapi.responses import JSONResponse
from starlette.applications import Starlette
from starlette.testclient import TestClient
from stac_fastapi.api.app import StacApi
from stac_fastapi.api.middleware import ProxyHeaderMiddleware
from stac_fasta... | value | assert | variable | stac_fastapi/api/tests/test_middleware.py | test_replace_header_value_by_name | 71 | null | |
stac-utils/stac-fastapi | import json
import pytest
from fastapi import Depends, FastAPI, HTTPException
from fastapi.testclient import TestClient
from pydantic import BaseModel, ValidationError
from stac_fastapi.api.models import create_get_request_model, create_post_request_model
from stac_fastapi.extensions.core import FieldsExtension, Filt... | 10 | assert | numeric_literal | stac_fastapi/api/tests/test_models.py | test_create_get_request_model | 46 | null | |
stac-utils/stac-fastapi | import json
from typing import Iterator, List, Union
import pytest
from stac_pydantic import Collection
from stac_pydantic.item import Item
from stac_pydantic.item_collection import ItemCollection
from starlette.testclient import TestClient
from stac_fastapi.api.app import StacApi
from stac_fastapi.extensions.core im... | "Feature" | assert | string_literal | stac_fastapi/extensions/tests/test_transaction.py | test_create_item | 104 | null | |
ramnes/notion-sdk-py | import asyncio
import time
from types import AsyncGeneratorType, GeneratorType
import pytest
from notion_client.helpers import (
async_collect_data_source_templates,
async_collect_paginated_api,
async_iterate_data_source_templates,
async_iterate_paginated_api,
collect_data_source_templates,
co... | url | assert | variable | tests/test_helpers.py | test_get_url | 72 | null | |
ramnes/notion-sdk-py | import pytest
import json
from unittest.mock import Mock, patch
from notion_client import APIResponseError, AsyncClient, Client
import httpx
def test_build_request_with_file_object():
"""Test _build_request with file-like objects to cover line 130 (tuple case)."""
client = Client()
client.client = Mock()
... | call_args[1]["data"] | assert | complex_expr | tests/test_client.py | test_build_request_with_file_object | 92 | null | |
ramnes/notion-sdk-py | import pytest
from httpx import TimeoutException
import httpx
import asyncio
from notion_client.errors import (
APIErrorCode,
ClientErrorCode,
is_notion_client_error,
RequestTimeoutError,
InvalidPathParameterError,
validate_request_path,
HTTPResponseError,
is_http_response_error,
Un... | "rate_limited" | assert | string_literal | tests/test_errors.py | test_error_code_enums | 368 | null | |
ramnes/notion-sdk-py | import pytest
import io
@pytest.mark.vcr()
def test_blocks_children_create(client, page_id) -> str:
children = [
{"paragraph": {"rich_text": [{"text": {"content": "I'm a paragraph."}}]}}
]
response = client.blocks.children.append(block_id=page_id, children=children)
assert response["object"]... | "list" | assert | string_literal | tests/test_endpoints.py | test_blocks_children_create | 52 | null | |
ramnes/notion-sdk-py | import pytest
import json
from unittest.mock import Mock, patch
from notion_client import APIResponseError, AsyncClient, Client
import httpx
@pytest.mark.vcr()
def test_client_request(client):
with pytest.raises( | APIResponseError) | pytest.raises | variable | tests/test_client.py | test_client_request | 19 | null | |
ramnes/notion-sdk-py | import pytest
import json
from unittest.mock import Mock, patch
from notion_client import APIResponseError, AsyncClient, Client
import httpx
def test_build_request_with_file_object():
"""Test _build_request with file-like objects to cover line 130 (tuple case)."""
client = Client()
client.client = Mock()
... | call_args[1]["files"] | assert | complex_expr | tests/test_client.py | test_build_request_with_file_object | 91 | null | |
ramnes/notion-sdk-py | import pytest
import json
from unittest.mock import Mock, patch
from notion_client import APIResponseError, AsyncClient, Client
import httpx
def test_build_request_with_form_data():
client = Client()
form_data = {
"file": b"file_content",
"filename": "test.txt",
"content_type": "text/... | "POST" | assert | string_literal | tests/test_client.py | test_build_request_with_form_data | 72 | null | |
ramnes/notion-sdk-py | import asyncio
import time
from types import AsyncGeneratorType, GeneratorType
import pytest
from notion_client.helpers import (
async_collect_data_source_templates,
async_collect_paginated_api,
async_iterate_data_source_templates,
async_iterate_paginated_api,
collect_data_source_templates,
co... | 5 | assert | numeric_literal | tests/test_helpers.py | test_iterate_paginated_api | 93 | null | |
ramnes/notion-sdk-py | import pytest
import io
@pytest.mark.vcr()
def test_pages_update(client, page_id):
icon = {"type": "emoji", "emoji": "🛴"}
response = client.pages.update(page_id=page_id, icon=icon)
assert response["icon"]
response = client.pages.update(page_id=page_id, icon=None)
assert response["icon"] is | None | assert | none_literal | tests/test_endpoints.py | test_pages_update | 35 | null | |
ramnes/notion-sdk-py | import pytest
import io
@pytest.mark.vcr()
def test_file_uploads_send_multipart(client, pending_multi_file_upload_id):
"""Test sending a multipart file upload"""
# Send first part
test_content_part1 = b"A" * (10 * 1024 * 1024)
file_part1 = io.BytesIO(test_content_part1)
file_part1.name = "test_file... | 1 | assert | numeric_literal | tests/test_endpoints.py | test_file_uploads_send_multipart | 381 | null | |
ramnes/notion-sdk-py | import pytest
import json
from unittest.mock import Mock, patch
from notion_client import APIResponseError, AsyncClient, Client
import httpx
def test_build_request_with_form_data():
client = Client()
form_data = {
"file": b"file_content",
"filename": "test.txt",
"content_type": "text/... | str(request.url) | assert | func_call | tests/test_client.py | test_build_request_with_form_data | 73 | null | |
ramnes/notion-sdk-py | import pytest
from httpx import TimeoutException
import httpx
import asyncio
from notion_client.errors import (
APIErrorCode,
ClientErrorCode,
is_notion_client_error,
RequestTimeoutError,
InvalidPathParameterError,
validate_request_path,
HTTPResponseError,
is_http_response_error,
Un... | "success" | assert | string_literal | tests/test_errors.py | test_request_timeout_error_reject_after_timeout | 396 | null | |
ramnes/notion-sdk-py | import pytest
import json
from unittest.mock import Mock, patch
from notion_client import APIResponseError, AsyncClient, Client
import httpx
def test_client_request_timeout():
client = Client()
with patch.object(
client.client, "send", side_effect=httpx.TimeoutException("Timeout")
):
from... | RequestTimeoutError) | pytest.raises | variable | tests/test_client.py | test_client_request_timeout | 173 | null | |
ramnes/notion-sdk-py | import asyncio
import time
from types import AsyncGeneratorType, GeneratorType
import pytest
from notion_client.helpers import (
async_collect_data_source_templates,
async_collect_paginated_api,
async_iterate_data_source_templates,
async_iterate_paginated_api,
collect_data_source_templates,
co... | {} | assert | collection | tests/test_helpers.py | test_pick | 49 | null | |
ramnes/notion-sdk-py | import pytest
from httpx import TimeoutException
import httpx
import asyncio
from notion_client.errors import (
APIErrorCode,
ClientErrorCode,
is_notion_client_error,
RequestTimeoutError,
InvalidPathParameterError,
validate_request_path,
HTTPResponseError,
is_http_response_error,
Un... | 500 | assert | numeric_literal | tests/test_errors.py | test_build_request_error_creates_unknown_http_response_error | 300 | null | |
ramnes/notion-sdk-py | import pytest
from httpx import TimeoutException
import httpx
import asyncio
from notion_client.errors import (
APIErrorCode,
ClientErrorCode,
is_notion_client_error,
RequestTimeoutError,
InvalidPathParameterError,
validate_request_path,
HTTPResponseError,
is_http_response_error,
Un... | APIResponseError) | pytest.raises | variable | tests/test_errors.py | test_build_request_error_integration | 224 | null | |
ramnes/notion-sdk-py | import asyncio
import time
from types import AsyncGeneratorType, GeneratorType
import pytest
from notion_client.helpers import (
async_collect_data_source_templates,
async_collect_paginated_api,
async_iterate_data_source_templates,
async_iterate_paginated_api,
collect_data_source_templates,
co... | None | assert | none_literal | tests/test_helpers.py | test_extract_block_id_returns_none_without_fragment | 322 | null | |
ramnes/notion-sdk-py | import pytest
from httpx import TimeoutException
import httpx
import asyncio
from notion_client.errors import (
APIErrorCode,
ClientErrorCode,
is_notion_client_error,
RequestTimeoutError,
InvalidPathParameterError,
validate_request_path,
HTTPResponseError,
is_http_response_error,
Un... | "abc-123-def" | assert | string_literal | tests/test_errors.py | test_build_request_error_creates_api_response_error | 276 | null | |
ramnes/notion-sdk-py | import pytest
from httpx import TimeoutException
import httpx
import asyncio
from notion_client.errors import (
APIErrorCode,
ClientErrorCode,
is_notion_client_error,
RequestTimeoutError,
InvalidPathParameterError,
validate_request_path,
HTTPResponseError,
is_http_response_error,
Un... | 404 | assert | numeric_literal | tests/test_errors.py | test_build_request_error_integration | 231 | null | |
ramnes/notion-sdk-py | import asyncio
import time
from types import AsyncGeneratorType, GeneratorType
import pytest
from notion_client.helpers import (
async_collect_data_source_templates,
async_collect_paginated_api,
async_iterate_data_source_templates,
async_iterate_paginated_api,
collect_data_source_templates,
co... | [] | assert | collection | tests/test_helpers.py | test_collect_paginated_api | 116 | null | |
ramnes/notion-sdk-py | import asyncio
import time
from types import AsyncGeneratorType, GeneratorType
import pytest
from notion_client.helpers import (
async_collect_data_source_templates,
async_collect_paginated_api,
async_iterate_data_source_templates,
async_iterate_paginated_api,
collect_data_source_templates,
co... | 0 | assert | numeric_literal | tests/test_helpers.py | test_iterate_paginated_api | 107 | null | |
ramnes/notion-sdk-py | import pytest
import io
@pytest.mark.vcr()
def test_pages_create(client, parent_page_id):
response = client.pages.create(
parent={"page_id": parent_page_id},
properties={
"title": [{"text": {"content": "Test Page"}}],
},
children=[],
)
assert response["object"]... | "page" | assert | string_literal | tests/test_endpoints.py | test_pages_create | 15 | null | |
ramnes/notion-sdk-py | import pytest
from httpx import TimeoutException
import httpx
import asyncio
from notion_client.errors import (
APIErrorCode,
ClientErrorCode,
is_notion_client_error,
RequestTimeoutError,
InvalidPathParameterError,
validate_request_path,
HTTPResponseError,
is_http_response_error,
Un... | api_code | assert | variable | tests/test_errors.py | test_build_request_error_creates_api_response_error | 287 | null | |
ramnes/notion-sdk-py | import pytest
import io
@pytest.mark.vcr()
def test_users_me(client):
response = client.users.me()
assert response["type"] == | "bot" | assert | string_literal | tests/test_endpoints.py | test_users_me | 106 | null | |
ramnes/notion-sdk-py | import pytest
from httpx import TimeoutException
import httpx
import asyncio
from notion_client.errors import (
APIErrorCode,
ClientErrorCode,
is_notion_client_error,
RequestTimeoutError,
InvalidPathParameterError,
validate_request_path,
HTTPResponseError,
is_http_response_error,
Un... | str(error) | assert | func_call | tests/test_errors.py | test_unknown_http_response_error_default_message | 350 | null | |
ramnes/notion-sdk-py | import pytest
import io
@pytest.mark.vcr()
def test_blocks_children_create(client, page_id) -> str:
children = [
{"paragraph": {"rich_text": [{"text": {"content": "I'm a paragraph."}}]}}
]
response = client.blocks.children.append(block_id=page_id, children=children)
assert response["object"] ... | 0 | assert | numeric_literal | tests/test_endpoints.py | test_blocks_children_create | 53 | null | |
ramnes/notion-sdk-py | import pytest
import io
@pytest.mark.vcr()
def test_users_retrieve(client):
me = client.users.me()
response = client.users.retrieve(me["id"])
me.pop("request_id", None)
response.pop("request_id", None)
assert response == | me | assert | variable | tests/test_endpoints.py | test_users_retrieve | 118 | null | |
ramnes/notion-sdk-py | import pytest
from httpx import TimeoutException
import httpx
import asyncio
from notion_client.errors import (
APIErrorCode,
ClientErrorCode,
is_notion_client_error,
RequestTimeoutError,
InvalidPathParameterError,
validate_request_path,
HTTPResponseError,
is_http_response_error,
Un... | "unauthorized" | assert | string_literal | tests/test_errors.py | test_error_code_enums | 366 | null | |
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_uni... | key3 | assert | variable | tests/test_core_cache.py | test_make_key_uniqueness | 30 | 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_section_raises_error(mock_config: Config):
# test that trying to get a value from a section key raises ConfigError
with pytest.raises( | ConfigError, match="key does not contain a value") | pytest.raises | complex_expr | tests/test_core_config.py | test_config_get_section_raises_error | 34 | 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_and_get_new_value(mock_config: Config):
# test setting a new value and then getting it back
mock_config.set("new.section.key", "new_value")
... | "new_value" | assert | string_literal | tests/test_core_config.py | test_config_set_and_get_new_value | 41 | 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.exi... | result.output | assert | complex_expr | tests/test_cli.py | test_cli_version | 15 | 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... | target_theme | assert | variable | tests/screens/test_theme_selector.py | test_theme_selector_select_theme_with_enter | 64 | 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": {
... | True | assert | bool_literal | tests/test_indexers.py | test_healthcheck | 70 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.