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 |
|---|---|---|---|---|---|---|---|---|---|
feldroy/air | import re
from typer.testing import CliRunner
from air.cli import app
runner = CliRunner()
def strip_ansi(text: str) -> str:
"""Remove ANSI escape codes from text.
Returns:
Text with ANSI escape codes removed.
"""
return re.sub(r"\x1b\[[0-9;]*m", "", text)
def test_cli_help() -> None:
... | output | assert | variable | tests/test_cli.py | test_cli_help | 27 | null | |
feldroy/air | from __future__ import annotations
import sys
import types
from collections import UserString
from dataclasses import dataclass
from typing import TYPE_CHECKING, Any
import pytest
from examples.samples.air_tag_samples import AIR_TAG_SAMPLE, SMALL_AIR_TAG_SAMPLE
from examples.samples.html_samples import FRAGMENT_HTML_... | "id" | assert | string_literal | tests/tags/test_tags_utils.py | test_migrate_attribute_name_to_html | 161 | null | |
feldroy/air | from fastapi.testclient import TestClient
from .layouts__picocss import app
def test_index_renders_full_layout() -> None:
"""Test that index page renders full HTML layout with PicoCSS"""
client = TestClient(app)
response = client.get("/")
assert response.status_code == | 200 | assert | numeric_literal | examples/src/layouts__picocss__test.py | test_index_renders_full_layout | 10 | null | |
feldroy/air | from __future__ import annotations
import sys
import types
from collections import UserString
from dataclasses import dataclass
from typing import TYPE_CHECKING, Any
import pytest
from examples.samples.air_tag_samples import AIR_TAG_SAMPLE, SMALL_AIR_TAG_SAMPLE
from examples.samples.html_samples import FRAGMENT_HTML_... | expected_html | assert | variable | tests/tags/test_tags_utils.py | test_read_html | 492 | null | |
feldroy/air | from fastapi.testclient import TestClient
from .models__AirModel__to_form import app
def test_form_renders_with_all_parameters() -> None:
"""Test that form renders with name, includes, and widget parameters"""
client = TestClient(app)
response = client.get("/")
assert response.status_code == | 200 | assert | numeric_literal | examples/src/models__AirModel__to_form__test.py | test_form_renders_with_all_parameters | 10 | null | |
feldroy/air | import inspect
from collections.abc import Callable
from functools import wraps
from typing import Any
from air.utils import cached_signature, cached_unwrap, compute_page_path
def test_compute_page_path_returns_root_for_index_endpoint() -> None:
actual_path = compute_page_path(endpoint_name="index")
assert a... | "/" | assert | string_literal | tests/test_utils.py | test_compute_page_path_returns_root_for_index_endpoint | 11 | null | |
feldroy/air | import inspect
from collections.abc import Callable
from functools import wraps
from typing import Any
from air.utils import cached_signature, cached_unwrap, compute_page_path
def test_cached_signature_basic() -> None:
"""Test basic cached_signature functionality."""
def sample_func(a: int, b: str) -> None:
... | sig2 | assert | variable | tests/test_utils.py | test_cached_signature_basic | 44 | null | |
feldroy/air | from collections.abc import Sequence
from typing import Annotated, cast
import annotated_types
import pytest
from fastapi import Depends, Request
from fastapi.testclient import TestClient
from pydantic import BaseModel, Field
import air
def test_html5_validation_attributes() -> None:
"""Test that HTML5 validatio... | 3 | assert | numeric_literal | tests/test_forms.py | test_html5_validation_attributes | 488 | null | |
feldroy/air | import json
from typing import Annotated
from fastapi.testclient import TestClient
from air import H1, Air, AirRequest, Request, is_htmx_request
def test_is_htmx() -> None:
"""Test the is_htmx method, which only works if the response is wrapped."""
app = Air()
@app.get("/test")
def is_htmx(is_htmx:... | 200 | assert | numeric_literal | tests/test_requests.py | test_is_htmx | 21 | null | |
feldroy/air | from fastapi.testclient import TestClient
from examples.src.forms__AirField import app
client = TestClient(app)
def test_contact_form_renders_with_html5_attributes() -> None:
"""GET / should render the form with HTML5 attributes from AirField."""
response = client.get("/")
assert response.status_code ==... | 200 | assert | numeric_literal | examples/src/forms__AirField__test.py | test_contact_form_renders_with_html5_attributes | 13 | null | |
feldroy/air | from collections.abc import Callable
from functools import wraps
from typing import Any
from air.utils import cached_unwrap
def test_cached_unwrap() -> None:
def decorator(f: Callable[..., Any]) -> Callable[..., Any]:
@wraps(f)
def wrapper(*args: Any, **kwargs: Any) -> Any:
return f(*a... | original2 | assert | variable | examples/src/utils__cached_unwrap__test.py | test_cached_unwrap | 25 | null | |
feldroy/air | from __future__ import annotations
import pytest
from lxml.etree import ParserError
from air.tags.constants import HTML_DOCTYPE
from air.tags.utils import (
format_html,
pretty_format_html,
)
def _expected_format_html_fragment(*, pretty: bool, with_doctype: bool) -> str:
base: str = "<p>Hi</p>\n" if pre... | "ParserError" | assert | string_literal | tests/tags/test_html_utils.py | test_format_html_empty_raises_parser_error | 115 | null | |
feldroy/air | from typing import NoReturn
import pytest
from fastapi.exceptions import HTTPException as FastAPIHTTPException
from fastapi.testclient import TestClient
import air
def test_init_signature_compat() -> None:
e = air.HTTPException(status_code=418, detail="teapot", headers={"X-Foo": "Bar"})
assert e.status_code ... | "teapot" | assert | string_literal | tests/test_exceptions.py | test_init_signature_compat | 13 | null | |
feldroy/air | import json
from collections import defaultdict
from pathlib import Path
import pytest
from scripts.missing_examples import (
check_docstring_for_example,
extract_callables_from_file,
main,
)
def project_dirs(tmp_path: Path) -> tuple[Path, Path]:
"""Create the standard project directory structure for ... | 1 | assert | numeric_literal | tests/scripts/test_missing_examples.py | test_main_check_mode_fails_with_new_missing | 458 | null | |
feldroy/air | from collections.abc import AsyncGenerator
from contextlib import asynccontextmanager
import pytest
from fastapi import Depends
from fastapi.testclient import TestClient
from starlette.responses import HTMLResponse
from starlette.routing import BaseRoute, NoMatchFound
import air
from air import H1
from air.responses ... | 0 | assert | numeric_literal | tests/test_routing.py | test_air_router_proxy_properties | 557 | null | |
feldroy/air | from fastapi.testclient import TestClient
from .models__AirModel__to_form import app
def test_form_renders_with_all_parameters() -> None:
"""Test that form renders with name, includes, and widget parameters"""
client = TestClient(app)
response = client.get("/")
assert response.status_code == 200
#... | response.text | assert | complex_expr | examples/src/models__AirModel__to_form__test.py | test_form_renders_with_all_parameters | 12 | null | |
feldroy/air | import air
from tests.utils import clean_doc, clean_doc_with_broken_lines
def test_circle_with_attributes() -> None:
circle = air.svg.Circle(cx=50, cy=50, r=25, class_="my-circle")
expected = '<circle cx="50" cy="50" r="25" class="my-circle"></circle>'
assert circle.render() == | expected | assert | variable | tests/tags/test_svg.py | test_circle_with_attributes | 43 | null | |
feldroy/air | import sys
import types
from unittest.mock import Mock
import jinja2
import pytest
from fastapi import FastAPI
from fastapi.testclient import TestClient
from full_match import match as full_match
from jinja2 import FileSystemLoader
from starlette.datastructures import URL
from starlette.responses import HTMLResponse
... | "Test" | assert | string_literal | tests/test_templating.py | test_renderer_filter_context_with_request | 442 | null | |
feldroy/air | from typing import Any, override
import pytest
from full_match import match as full_match
import air
from tests.utils import clean_doc
def _r(tag: air.BaseTag) -> str:
"""Shortcut for easy renders.
Returns:
Rendered HTML string.
"""
return tag.render()
def test_children_tag() -> None:
h... | "<p>Hello, world!</p>" | assert | string_literal | tests/tags/test_tags.py | test_children_tag | 265 | null | |
feldroy/air | from typing import NoReturn
import pytest
from fastapi.exceptions import HTTPException as FastAPIHTTPException
from fastapi.testclient import TestClient
import air
def test_headers_passthrough() -> None:
app = air.Air()
@app.get("/with-headers")
def with_headers() -> NoReturn:
raise air.HTTPExce... | 429 | assert | numeric_literal | tests/test_exceptions.py | test_headers_passthrough | 64 | null | |
feldroy/air | from __future__ import annotations
import ast
import json
from pathlib import Path
from typing import TYPE_CHECKING, Any, Final
import pytest
from examples.samples.air_tag_samples import (
AIR_TAG_SAMPLE,
FRAGMENT_AIR_TAG_SAMPLE,
SMALL_AIR_TAG_SAMPLE,
TINY_AIR_TAG_SAMPLE,
)
from examples.samples.air_t... | 884015 | assert | numeric_literal | tests/tags/test_base_tag.py | test_compact_format_html_minifies | 154 | null | |
feldroy/air | import inspect
from collections.abc import Callable
from functools import wraps
from typing import Any
from air.utils import cached_signature, cached_unwrap, compute_page_path
def test_cached_unwrap_multiple_decorators() -> None:
"""Test cached_unwrap with multiple layers of decorators."""
def decorator1(f: ... | "result" | assert | string_literal | tests/test_utils.py | test_cached_unwrap_multiple_decorators | 133 | null | |
feldroy/air | from fastapi.testclient import TestClient
from .forms__AirForm__validate import app
def test_validate_with_valid_data() -> None:
"""Test validate method with valid form data"""
client = TestClient(app)
response = client.post("/flight", data={"flight_number": "AA123", "destination": "New York"})
asser... | 200 | assert | numeric_literal | examples/src/forms__AirForm__validate__test.py | test_validate_with_valid_data | 10 | null | |
feldroy/air | import inspect
from air.utils import cached_signature
def test_cached_signature() -> None:
def my_func(a: int, b: str) -> None:
pass
sig = cached_signature(my_func)
# Subsequent calls with same function use cached result
sig2 = cached_signature(my_func) # Fast!
# Verify both signatures ... | 2 | assert | numeric_literal | examples/src/utils__cached_signature__test.py | test_cached_signature | 17 | null | |
feldroy/air | import json
from collections import defaultdict
from pathlib import Path
import pytest
from scripts.missing_examples import (
check_docstring_for_example,
extract_callables_from_file,
main,
)
def project_dirs(tmp_path: Path) -> tuple[Path, Path]:
"""Create the standard project directory structure for ... | results | assert | variable | tests/scripts/test_missing_examples.py | test_extract_callables_from_file | 79 | null | |
feldroy/air | from collections.abc import Callable
from functools import wraps
from typing import Any
from air.utils import cached_unwrap
def test_cached_unwrap() -> None:
def decorator(f: Callable[..., Any]) -> Callable[..., Any]:
@wraps(f)
def wrapper(*args: Any, **kwargs: Any) -> Any:
return f(*a... | "my_func" | assert | string_literal | examples/src/utils__cached_unwrap__test.py | test_cached_unwrap | 26 | null | |
feldroy/air | from __future__ import annotations
import sys
import types
from collections import UserString
from dataclasses import dataclass
from typing import TYPE_CHECKING, Any
import pytest
from examples.samples.air_tag_samples import AIR_TAG_SAMPLE, SMALL_AIR_TAG_SAMPLE
from examples.samples.html_samples import FRAGMENT_HTML_... | "payload" | assert | string_literal | tests/tags/test_tags_utils.py | test_save_text_writes_content | 473 | null | |
feldroy/air | from __future__ import annotations
import sys
import types
from collections import UserString
from dataclasses import dataclass
from typing import TYPE_CHECKING, Any
import pytest
from examples.samples.air_tag_samples import AIR_TAG_SAMPLE, SMALL_AIR_TAG_SAMPLE
from examples.samples.html_samples import FRAGMENT_HTML_... | 7536 | assert | numeric_literal | tests/tags/test_tags_utils.py | test_compact_format_html_minifies | 194 | null | |
feldroy/air | from __future__ import annotations
import pytest
from lxml.etree import ParserError
from air.tags.constants import HTML_DOCTYPE
from air.tags.utils import (
format_html,
pretty_format_html,
)
def _expected_format_html_fragment(*, pretty: bool, with_doctype: bool) -> str:
base: str = "<p>Hi</p>\n" if pre... | expected | assert | variable | tests/tags/test_html_utils.py | test_format_html_all_parameter_combinations | 80 | null | |
feldroy/air | from fastapi.testclient import TestClient
from examples.src.forms__AirForm import app
client = TestClient(app)
def test_flight_form_valid() -> None:
"""Test flight form with valid data."""
response = client.post("/flight", data={"flight_number": "AA123", "destination": "LAX"})
assert response.status_code... | response.text | assert | complex_expr | examples/src/forms__AirForm__test.py | test_flight_form_valid | 14 | null | |
feldroy/air | import json
from typing import Annotated
from fastapi.testclient import TestClient
from air import H1, Air, AirRequest, Request, is_htmx_request
def test_is_htmx() -> None:
"""Test the is_htmx method, which only works if the response is wrapped."""
app = Air()
@app.get("/test")
def is_htmx(is_htmx:... | "text/html; charset=utf-8" | assert | string_literal | tests/test_requests.py | test_is_htmx | 22 | null | |
feldroy/air | from collections.abc import AsyncGenerator
from typing import override
from fastapi import status
from fastapi.testclient import TestClient
import air
from air import H1, AirResponse, Article, BaseTag, Div, Html, Main
from air.responses import TagResponse
from .utils import clean_doc
def test_tag_response_obj() -> ... | 200 | assert | numeric_literal | tests/test_responses.py | test_tag_response_obj | 31 | null | |
feldroy/air | import gc
import logging
import tracemalloc
import pytest
import air
from air import Div, Span
logging.basicConfig(level=logging.INFO, format="%(message)s")
@pytest.mark.memory
def test_tag_object_memory_cleanup() -> None:
"""Verify that creating and destroying many tag objects doesn't leak memory.
This te... | max_allowed_growth | assert | variable | tests/benchmarks/test_memory_tag_cleanup.py | test_tag_object_memory_cleanup | 77 | null | |
feldroy/air | from fastapi.testclient import TestClient
from .forms__default_form_widget import app
def test_form_renders_with_prepopulated_data() -> None:
"""Test that default_form_widget renders form with custom layout using includes"""
client = TestClient(app)
response = client.get("/")
assert response.status_co... | response.text | assert | complex_expr | examples/src/forms__default_form_widget__test.py | test_form_renders_with_prepopulated_data | 11 | null | |
feldroy/air | from fastapi import Depends, FastAPI
from fastapi.routing import APIRouter
from fastapi.testclient import TestClient
from starlette.requests import Request
import air
from air.exception_handlers import (
DEFAULT_EXCEPTION_HANDLERS,
default_500_exception_handler,
)
def test_app_state() -> None:
"""Test tha... | 1 | assert | numeric_literal | tests/test_applications.py | test_app_state | 296 | null | |
feldroy/air | import re
from typer.testing import CliRunner
from air.cli import app
runner = CliRunner()
def strip_ansi(text: str) -> str:
"""Remove ANSI escape codes from text.
Returns:
Text with ANSI escape codes removed.
"""
return re.sub(r"\x1b\[[0-9;]*m", "", text)
def test_cli_version() -> None:
... | result.output | assert | complex_expr | tests/test_cli.py | test_cli_version | 36 | null | |
feldroy/air | import json
from typing import Annotated
from fastapi.testclient import TestClient
from air import H1, Air, AirRequest, Request, is_htmx_request
def test_htmx_triggering_event() -> None:
app = Air()
@app.get("/test")
def triggering_event(request: AirRequest) -> H1:
event = request.htmx.triggerin... | "<h1>Event: None</h1>" | assert | string_literal | tests/test_requests.py | test_htmx_triggering_event | 209 | null | |
feldroy/air | from __future__ import annotations
import ast
import json
from pathlib import Path
from typing import TYPE_CHECKING, Any, Final
import pytest
from examples.samples.air_tag_samples import (
AIR_TAG_SAMPLE,
FRAGMENT_AIR_TAG_SAMPLE,
SMALL_AIR_TAG_SAMPLE,
TINY_AIR_TAG_SAMPLE,
)
from examples.samples.air_t... | "pretty" | assert | string_literal | tests/tags/test_base_tag.py | test_pretty_render_passes_flags_to_formatter | 142 | null | |
feldroy/air | from fastapi.testclient import TestClient
from .middleware__SessionMiddleware import app
def test_session_persistence() -> None:
client = TestClient(app)
response = client.get("/")
assert response.status_code == 200
assert response.headers["content-type"] == | "text/html; charset=utf-8" | assert | string_literal | examples/src/middleware__SessionMiddleware__test.py | test_session_persistence | 11 | null | |
feldroy/air | from __future__ import annotations
from fastapi.testclient import TestClient
import air
def test_request_param_with_future_annotations() -> None:
"""Ensure Request parameter works with 'from __future__ import annotations'."""
app = air.Air()
@app.get("/test")
def htmx_status(request: air.Request, *,... | 200 | assert | numeric_literal | tests/test_requests_future_annotations.py | test_request_param_with_future_annotations | 25 | null | |
feldroy/air | import air
from air import SelfClosingTag
def test_stock_tags_comprehensive_coverage() -> None:
"""Test that covers all stock tag classes to improve __init__ coverage."""
# Test BaseTag subclasses with children and various attributes
tags_with_children = [
# Basic tags
air.A("Link", href="... | 90 | assert | numeric_literal | tests/tags/test_stock_tags_coverage.py | test_stock_tags_comprehensive_coverage | 149 | null | |
feldroy/air | from collections.abc import AsyncGenerator
from contextlib import asynccontextmanager
import pytest
from fastapi import Depends
from fastapi.testclient import TestClient
from starlette.responses import HTMLResponse
from starlette.routing import BaseRoute, NoMatchFound
import air
from air import H1
from air.responses ... | 200 | assert | numeric_literal | tests/test_routing.py | test_air_routing | 34 | null | |
feldroy/air | from collections.abc import AsyncGenerator
from typing import override
from fastapi import status
from fastapi.testclient import TestClient
import air
from air import H1, AirResponse, Article, BaseTag, Div, Html, Main
from air.responses import TagResponse
from .utils import clean_doc
def test_sse_response_bytes_con... | "already encoded" | assert | string_literal | tests/test_responses.py | test_sse_response_bytes_content | 287 | null | |
feldroy/air | from fastapi.testclient import TestClient
from .exception_handlers__default_404_router_handler import app
def test_default_404_router_handler() -> None:
client = TestClient(app)
response = client.get("/example")
assert response.status_code == 404
assert response.text == | "<p>I am an example route.</p>" | assert | string_literal | examples/src/exception_handlers__default_404_router_handler__test.py | test_default_404_router_handler | 10 | null | |
feldroy/air | import inspect
from collections.abc import Callable
from functools import wraps
from typing import Any
from air.utils import cached_signature, cached_unwrap, compute_page_path
def test_compute_page_path_with_forward_slash_separator() -> None:
actual_path = compute_page_path(endpoint_name="api_users", separator="/... | "/api/users" | assert | string_literal | tests/test_utils.py | test_compute_page_path_with_forward_slash_separator | 26 | null | |
feldroy/air | from pathlib import Path
import pytest
from scripts.copy_src_example_to_callable import (
main,
parse_filename_class,
update_example_section,
)
def project_dirs(tmp_path: Path) -> tuple[Path, Path, Path]:
"""Create the standard project directory structure for testing main().
Returns:
Tupl... | True | assert | bool_literal | tests/scripts/test_copy_src_example_to_callable.py | test_update_example_section_updates_function_docstring | 79 | null | |
feldroy/air | import json
from collections import defaultdict
from pathlib import Path
import pytest
from scripts.missing_examples import (
check_docstring_for_example,
extract_callables_from_file,
main,
)
def project_dirs(tmp_path: Path) -> tuple[Path, Path]:
"""Create the standard project directory structure for ... | True | assert | bool_literal | tests/scripts/test_missing_examples.py | test_check_docstring_for_example | 29 | null | |
feldroy/air | from fastapi import Depends, FastAPI
from fastapi.routing import APIRouter
from fastapi.testclient import TestClient
from starlette.requests import Request
import air
from air.exception_handlers import (
DEFAULT_EXCEPTION_HANDLERS,
default_500_exception_handler,
)
def test_air_app_factory() -> None:
app =... | 200 | assert | numeric_literal | tests/test_applications.py | test_air_app_factory | 24 | null | |
feldroy/air | from fastapi.testclient import TestClient
from .exception_handlers__default_500_exception_handler import app
def test_exception_handling_500() -> None:
client = TestClient(app)
response = client.get("/")
assert response.status_code == 500
assert response.text == | "<p>500 Internal Server Error</p>" | assert | string_literal | examples/src/exception_handlers__default_500_exception_handler__test.py | test_exception_handling_500 | 11 | null | |
feldroy/air | from __future__ import annotations
import sys
import types
from collections import UserString
from dataclasses import dataclass
from typing import TYPE_CHECKING, Any
import pytest
from examples.samples.air_tag_samples import AIR_TAG_SAMPLE, SMALL_AIR_TAG_SAMPLE
from examples.samples.html_samples import FRAGMENT_HTML_... | "<span></span>" | assert | string_literal | tests/tags/test_tags_utils.py | test_format_html_uses_lxml_fragment_path | 239 | null | |
feldroy/air | from __future__ import annotations
from fastapi.testclient import TestClient
import air
def test_request_param_with_future_annotations() -> None:
"""Ensure Request parameter works with 'from __future__ import annotations'."""
app = air.Air()
@app.get("/test")
def htmx_status(request: air.Request, *,... | response.text | assert | complex_expr | tests/test_requests_future_annotations.py | test_request_param_with_future_annotations | 26 | null | |
feldroy/air | import inspect
from collections.abc import Callable
from functools import wraps
from typing import Any
from air.utils import cached_signature, cached_unwrap, compute_page_path
def test_cached_unwrap_basic() -> None:
"""Test basic cached_unwrap functionality."""
def decorator(f: Callable[..., Any]) -> Callabl... | unwrapped2 | assert | variable | tests/test_utils.py | test_cached_unwrap_basic | 103 | null | |
feldroy/air | from collections.abc import Callable
from functools import wraps
from typing import Any
from air.utils import cached_unwrap
def test_cached_unwrap() -> None:
def decorator(f: Callable[..., Any]) -> Callable[..., Any]:
@wraps(f)
def wrapper(*args: Any, **kwargs: Any) -> Any:
return f(*a... | my_func | assert | variable | examples/src/utils__cached_unwrap__test.py | test_cached_unwrap | 28 | null | |
feldroy/air | from collections.abc import AsyncGenerator
from typing import override
from fastapi import status
from fastapi.testclient import TestClient
import air
from air import H1, AirResponse, Article, BaseTag, Div, Html, Main
from air.responses import TagResponse
from .utils import clean_doc
def test_air_response_html() ->... | expected_html | assert | variable | tests/test_responses.py | test_air_response_html | 140 | null | |
feldroy/air | from fastapi.testclient import TestClient
from examples.src.forms__AirForm import app
client = TestClient(app)
def test_flight_form_valid() -> None:
"""Test flight form with valid data."""
response = client.post("/flight", data={"flight_number": "AA123", "destination": "LAX"})
assert response.status_cod... | 200 | assert | numeric_literal | examples/src/forms__AirForm__test.py | test_flight_form_valid | 13 | null | |
feldroy/air | from __future__ import annotations
import ast
import json
from pathlib import Path
from typing import TYPE_CHECKING, Any, Final
import pytest
from examples.samples.air_tag_samples import (
AIR_TAG_SAMPLE,
FRAGMENT_AIR_TAG_SAMPLE,
SMALL_AIR_TAG_SAMPLE,
TINY_AIR_TAG_SAMPLE,
)
from examples.samples.air_t... | "plain" | assert | string_literal | tests/tags/test_base_tag.py | test_to_dict_and_to_child_dict_structure | 312 | null | |
feldroy/air | from __future__ import annotations
import sys
import types
from collections import UserString
from dataclasses import dataclass
from typing import TYPE_CHECKING, Any
import pytest
from examples.samples.air_tag_samples import AIR_TAG_SAMPLE, SMALL_AIR_TAG_SAMPLE
from examples.samples.html_samples import FRAGMENT_HTML_... | value | assert | variable | tests/tags/test_tags_utils.py | test_safestr_behaves_like_str | 451 | null | |
feldroy/air | from pathlib import Path
import pytest
from scripts.copy_src_example_to_callable import (
main,
parse_filename_class,
update_example_section,
)
def project_dirs(tmp_path: Path) -> tuple[Path, Path, Path]:
"""Create the standard project directory structure for testing main().
Returns:
Tupl... | None | assert | none_literal | tests/scripts/test_copy_src_example_to_callable.py | test_parse_filename_class_returns_none_for_test_files | 45 | null | |
feldroy/air | from fastapi.testclient import TestClient
from .forms__AirForm__from_request import app
def test_from_request_with_valid_data() -> None:
"""Test from_request method with valid form data"""
client = TestClient(app)
response = client.post("/flight", data={"flight_number": "AA123", "destination": "New York"}... | 200 | assert | numeric_literal | examples/src/forms__AirForm__from_request__test.py | test_from_request_with_valid_data | 10 | null | |
feldroy/air | from fastapi import Depends, FastAPI
from fastapi.routing import APIRouter
from fastapi.testclient import TestClient
from starlette.requests import Request
import air
from air.exception_handlers import (
DEFAULT_EXCEPTION_HANDLERS,
default_500_exception_handler,
)
def test_default_500_exception_handler() -> N... | 500 | assert | numeric_literal | tests/test_applications.py | test_default_500_exception_handler | 159 | null | |
feldroy/air | import inspect
from air.utils import cached_signature
def test_cached_signature() -> None:
def my_func(a: int, b: str) -> None:
pass
sig = cached_signature(my_func)
# Subsequent calls with same function use cached result
sig2 = cached_signature(my_func) # Fast!
# Verify both signatures ... | sig2 | assert | variable | examples/src/utils__cached_signature__test.py | test_cached_signature | 15 | null | |
feldroy/air | from fastapi.testclient import TestClient
from .forms__AirForm__validate import app
def test_validate_with_valid_data() -> None:
"""Test validate method with valid form data"""
client = TestClient(app)
response = client.post("/flight", data={"flight_number": "AA123", "destination": "New York"})
assert... | response.text | assert | complex_expr | examples/src/forms__AirForm__validate__test.py | test_validate_with_valid_data | 11 | null | |
feldroy/air | from __future__ import annotations
import sys
import types
from collections import UserString
from dataclasses import dataclass
from typing import TYPE_CHECKING, Any
import pytest
from examples.samples.air_tag_samples import AIR_TAG_SAMPLE, SMALL_AIR_TAG_SAMPLE
from examples.samples.html_samples import FRAGMENT_HTML_... | "class" | assert | string_literal | tests/tags/test_tags_utils.py | test_migrate_attribute_name_to_html | 160 | null | |
feldroy/air | from __future__ import annotations
import sys
import types
from collections import UserString
from dataclasses import dataclass
from typing import TYPE_CHECKING, Any
import pytest
from examples.samples.air_tag_samples import AIR_TAG_SAMPLE, SMALL_AIR_TAG_SAMPLE
from examples.samples.html_samples import FRAGMENT_HTML_... | ["x = 1"] | assert | collection | tests/tags/test_tags_utils.py | test_pretty_print_python_outputs_code | 486 | null | |
feldroy/air | from fastapi.testclient import TestClient
from .dependencies___is_htmx_request import app
def test_is_htmx_get_request_without_htmx_header() -> None:
client = TestClient(app)
response = client.get("/")
assert response.status_code == 200
assert response.text == | "<h1>Is HTMX request?: False</h1>" | assert | string_literal | examples/src/dependencies___is_htmx_request__test.py | test_is_htmx_get_request_without_htmx_header | 19 | null | |
feldroy/air | import inspect
from collections.abc import Callable
from functools import wraps
from typing import Any
from air.utils import cached_signature, cached_unwrap, compute_page_path
def test_cached_signature_with_existing_signature_attribute() -> None:
"""Test that cached_signature uses __signature__ if already set."""... | original_sig | assert | variable | tests/test_utils.py | test_cached_signature_with_existing_signature_attribute | 64 | null | |
feldroy/air | from fastapi.testclient import TestClient
from examples.src.applications__Air__get import app
client = TestClient(app)
def test_hello_world() -> None:
"""Test basic GET endpoint."""
response = client.get("/hello")
assert response.status_code == | 200 | assert | numeric_literal | examples/src/applications__Air__get__test.py | test_hello_world | 13 | null | |
feldroy/air | from collections.abc import AsyncGenerator
from typing import override
from fastapi import status
from fastapi.testclient import TestClient
import air
from air import H1, AirResponse, Article, BaseTag, Div, Html, Main
from air.responses import TagResponse
from .utils import clean_doc
def test_redirect_response() ->... | response.url.path | assert | complex_expr | tests/test_responses.py | test_redirect_response | 309 | null | |
feldroy/air | from typing import NoReturn
import pytest
from fastapi.exceptions import HTTPException as FastAPIHTTPException
from fastapi.testclient import TestClient
import air
def test_headers_passthrough() -> None:
app = air.Air()
@app.get("/with-headers")
def with_headers() -> NoReturn:
raise air.HTTPExce... | {"detail": "too many requests"} | assert | collection | tests/test_exceptions.py | test_headers_passthrough | 67 | null | |
feldroy/air | from fastapi.testclient import TestClient
from .exception_handlers__default_404_router_handler import app
def test_default_404_router_handler() -> None:
client = TestClient(app)
response = client.get("/example")
assert response.status_code == | 404 | assert | numeric_literal | examples/src/exception_handlers__default_404_router_handler__test.py | test_default_404_router_handler | 9 | null | |
feldroy/air | import inspect
from collections.abc import Callable
from functools import wraps
from typing import Any
from pytest_benchmark.fixture import BenchmarkFixture
from air.utils import cached_signature, cached_unwrap
def sample_function(a: int, b: str, c: float = 1.0) -> str:
"""A sample function for signature inspect... | 3 | assert | numeric_literal | tests/benchmarks/test_inspect_caching_benchmark.py | test_signature_uncached_benchmark | 73 | null | |
feldroy/air | import inspect
from collections.abc import Callable
from functools import wraps
from typing import Any
from air.utils import cached_signature, cached_unwrap, compute_page_path
def test_cached_signature_basic() -> None:
"""Test basic cached_signature functionality."""
def sample_func(a: int, b: str) -> None:
... | sig1.parameters | assert | complex_expr | tests/test_utils.py | test_cached_signature_basic | 46 | null | |
feldroy/air | from __future__ import annotations
import ast
import json
from pathlib import Path
from typing import TYPE_CHECKING, Any, Final
import pytest
from examples.samples.air_tag_samples import (
AIR_TAG_SAMPLE,
FRAGMENT_AIR_TAG_SAMPLE,
SMALL_AIR_TAG_SAMPLE,
TINY_AIR_TAG_SAMPLE,
)
from examples.samples.air_t... | expected | assert | variable | tests/tags/test_base_tag.py | test_render_and_str_return_paired_markup | 89 | null | |
feldroy/air | from typing import NoReturn
import pytest
from fastapi.exceptions import HTTPException as FastAPIHTTPException
from fastapi.testclient import TestClient
import air
def test_custom_exception_handler_compat() -> None:
app = air.Air()
@app.exception_handler(FastAPIHTTPException)
async def custom_http_excep... | 403 | assert | numeric_literal | tests/test_exceptions.py | test_custom_exception_handler_compat | 85 | null | |
feldroy/air | from __future__ import annotations
import ast
import json
from pathlib import Path
from typing import TYPE_CHECKING, Any, Final
import pytest
from examples.samples.air_tag_samples import (
AIR_TAG_SAMPLE,
FRAGMENT_AIR_TAG_SAMPLE,
SMALL_AIR_TAG_SAMPLE,
TINY_AIR_TAG_SAMPLE,
)
from examples.samples.air_t... | loaded | assert | variable | tests/tags/test_base_tag.py | test_to_json_and_to_pretty_json_round_trip | 322 | null | |
feldroy/air | from __future__ import annotations
import ast
import json
from pathlib import Path
from typing import TYPE_CHECKING, Any, Final
import pytest
from examples.samples.air_tag_samples import (
AIR_TAG_SAMPLE,
FRAGMENT_AIR_TAG_SAMPLE,
SMALL_AIR_TAG_SAMPLE,
TINY_AIR_TAG_SAMPLE,
)
from examples.samples.air_t... | 760 | assert | numeric_literal | tests/tags/test_base_tag.py | test_compact_format_html_minifies | 152 | null | |
feldroy/air | import json
from collections import defaultdict
from pathlib import Path
import pytest
from scripts.missing_examples import (
check_docstring_for_example,
extract_callables_from_file,
main,
)
def project_dirs(tmp_path: Path) -> tuple[Path, Path]:
"""Create the standard project directory structure for ... | 0 | assert | numeric_literal | tests/scripts/test_missing_examples.py | test_extract_callables_from_file_handles_syntax_error | 98 | null | |
feldroy/air | from __future__ import annotations
import sys
import types
from collections import UserString
from dataclasses import dataclass
from typing import TYPE_CHECKING, Any
import pytest
from examples.samples.air_tag_samples import AIR_TAG_SAMPLE, SMALL_AIR_TAG_SAMPLE
from examples.samples.html_samples import FRAGMENT_HTML_... | "minified" | assert | string_literal | tests/tags/test_tags_utils.py | test_compact_format_html_minifies_with_safe_defaults | 209 | null | |
feldroy/air | import inspect
from air.utils import cached_signature
def test_cached_signature() -> None:
def my_func(a: int, b: str) -> None:
pass
sig = cached_signature(my_func)
# Subsequent calls with same function use cached result
sig2 = cached_signature(my_func) # Fast!
# Verify both signatures ... | sig.parameters | assert | complex_expr | examples/src/utils__cached_signature__test.py | test_cached_signature | 18 | null | |
feldroy/air | from fastapi.testclient import TestClient
from .routing__RouterMixin__page import app
def test_page_routes() -> None:
client = TestClient(app)
response = client.get("/")
assert response.status_code == | 200 | assert | numeric_literal | examples/src/routing__RouterMixin__page__test.py | test_page_routes | 10 | null | |
feldroy/air | from collections.abc import Sequence
from typing import Annotated, cast
import annotated_types
import pytest
from fastapi import Depends, Request
from fastapi.testclient import TestClient
from pydantic import BaseModel, Field
import air
def test_form_validation_dependency_injection() -> None:
class CheeseModel(B... | 200 | assert | numeric_literal | tests/test_forms.py | test_form_validation_dependency_injection | 59 | null | |
feldroy/air | from fastapi.testclient import TestClient
from .dependencies___is_htmx_request import app
def test_is_htmx_get_request_with_htmx_header() -> None:
client = TestClient(app)
response = client.get("/", headers={"HX-Request": "true"})
assert response.status_code == 200
assert response.text == | "<h1>Is HTMX request?: True</h1>" | assert | string_literal | examples/src/dependencies___is_htmx_request__test.py | test_is_htmx_get_request_with_htmx_header | 11 | null | |
feldroy/air | from typing import Any, override
import pytest
from full_match import match as full_match
import air
from tests.utils import clean_doc
def _r(tag: air.BaseTag) -> str:
"""Shortcut for easy renders.
Returns:
Rendered HTML string.
"""
return tag.render()
def test_tag_label_as() -> None:
h... | '<link as="fred">' | assert | string_literal | tests/tags/test_tags.py | test_tag_label_as | 307 | null | |
feldroy/air | from fastapi.testclient import TestClient
from examples.src.applications__Air__get import app
client = TestClient(app)
def test_hello_world() -> None:
"""Test basic GET endpoint."""
response = client.get("/hello")
assert response.status_code == 200
assert "Hello, World!" in | response.text | assert | complex_expr | examples/src/applications__Air__get__test.py | test_hello_world | 14 | null | |
feldroy/air | from typing import Any, override
import pytest
from full_match import match as full_match
import air
from tests.utils import clean_doc
def _r(tag: air.BaseTag) -> str:
"""Shortcut for easy renders.
Returns:
Rendered HTML string.
"""
return tag.render()
def test_raw_html_invalid_args() -> No... | TypeError) | pytest.raises | variable | tests/tags/test_tags.py | test_raw_html_invalid_args | 130 | null | |
feldroy/air | import inspect
from collections.abc import Callable
from functools import wraps
from typing import Any
from air.utils import cached_signature, cached_unwrap, compute_page_path
def test_cached_signature_basic() -> None:
"""Test basic cached_signature functionality."""
def sample_func(a: int, b: str) -> None:
... | 2 | assert | numeric_literal | tests/test_utils.py | test_cached_signature_basic | 45 | null | |
feldroy/air | from __future__ import annotations
import sys
import types
from collections import UserString
from dataclasses import dataclass
from typing import TYPE_CHECKING, Any
import pytest
from examples.samples.air_tag_samples import AIR_TAG_SAMPLE, SMALL_AIR_TAG_SAMPLE
from examples.samples.html_samples import FRAGMENT_HTML_... | "class_" | assert | string_literal | tests/tags/test_tags_utils.py | test_migrate_attribute_name_to_air_tag | 166 | null | |
feldroy/air | from fastapi.testclient import TestClient
from .forms__AirForm__render import app
client = TestClient(app)
def test_contact_form_renders() -> None:
"""GET /contact should render the form."""
response = client.get("/contact")
assert response.status_code == 200
assert "Contact us" in | response.text | assert | complex_expr | examples/src/forms__AirForm__render__test.py | test_contact_form_renders | 14 | null | |
feldroy/air | import json
from typing import Annotated
from fastapi.testclient import TestClient
from air import H1, Air, AirRequest, Request, is_htmx_request
def test_htmx_triggering_event() -> None:
app = Air()
@app.get("/test")
def triggering_event(request: AirRequest) -> H1:
event = request.htmx.triggerin... | "<h1>Event: click</h1>" | assert | string_literal | tests/test_requests.py | test_htmx_triggering_event | 206 | null | |
feldroy/air | from typing import NoReturn
import pytest
from fastapi.exceptions import HTTPException as FastAPIHTTPException
from fastapi.testclient import TestClient
import air
def test_headers_passthrough() -> None:
app = air.Air()
@app.get("/with-headers")
def with_headers() -> NoReturn:
raise air.HTTPExce... | "5" | assert | string_literal | tests/test_exceptions.py | test_headers_passthrough | 65 | null | |
feldroy/air | from __future__ import annotations
import sys
import types
from collections import UserString
from dataclasses import dataclass
from typing import TYPE_CHECKING, Any
import pytest
from examples.samples.air_tag_samples import AIR_TAG_SAMPLE, SMALL_AIR_TAG_SAMPLE
from examples.samples.html_samples import FRAGMENT_HTML_... | "panel" | assert | string_literal | tests/tags/test_tags_utils.py | test_export_pretty_html_uses_console | 398 | null | |
feldroy/air | from collections.abc import AsyncGenerator
from typing import override
from fastapi import status
from fastapi.testclient import TestClient
import air
from air import H1, AirResponse, Article, BaseTag, Div, Html, Main
from air.responses import TagResponse
from .utils import clean_doc
def test_tag_response_obj() -> ... | "<h1>Hello, World!</h1>" | assert | string_literal | tests/test_responses.py | test_tag_response_obj | 33 | null | |
feldroy/air | from fastapi.testclient import TestClient
from examples.src.applications__Air__post import app
client = TestClient(app)
def test_submit_form() -> None:
"""Test basic POST endpoint."""
response = client.post("/submit")
assert response.status_code == 200
assert "Form Submitted!" in | response.text | assert | complex_expr | examples/src/applications__Air__post__test.py | test_submit_form | 14 | null | |
feldroy/air | import inspect
from collections.abc import Callable
from functools import wraps
from typing import Any
from air.utils import cached_signature, cached_unwrap, compute_page_path
def test_compute_page_path_handles_multiple_underscores() -> None:
actual_path = compute_page_path(endpoint_name="user_profile_settings")
... | "/user-profile-settings" | assert | string_literal | tests/test_utils.py | test_compute_page_path_handles_multiple_underscores | 16 | null | |
feldroy/air | import gc
import logging
import tracemalloc
import pytest
import air
from air import Div, Span
logging.basicConfig(level=logging.INFO, format="%(message)s")
@pytest.mark.memory
def test_nested_tag_memory_efficiency() -> None:
"""Test memory usage patterns for deeply nested tag structures.
Verifies that com... | 512 * 1024 | assert | complex_expr | tests/benchmarks/test_memory_tag_cleanup.py | test_nested_tag_memory_efficiency | 138 | null | |
feldroy/air | from fastapi.testclient import TestClient
import air
def test_background_task_in_view() -> None:
app = air.Air()
elements = []
assert len(elements) == | 0 | assert | numeric_literal | tests/test_background.py | test_background_task_in_view | 11 | null | |
feldroy/air | from fastapi.testclient import TestClient
from .middleware__SessionMiddleware import app
def test_session_persistence() -> None:
client = TestClient(app)
response = client.get("/")
assert response.status_code == | 200 | assert | numeric_literal | examples/src/middleware__SessionMiddleware__test.py | test_session_persistence | 10 | null | |
feldroy/air | import json
from collections import defaultdict
from pathlib import Path
import pytest
from scripts.missing_examples import (
check_docstring_for_example,
extract_callables_from_file,
main,
)
def project_dirs(tmp_path: Path) -> tuple[Path, Path]:
"""Create the standard project directory structure for ... | False | assert | bool_literal | tests/scripts/test_missing_examples.py | test_check_docstring_for_example | 30 | null | |
feldroy/air | from collections.abc import Sequence
from typing import Annotated, cast
import annotated_types
import pytest
from fastapi import Depends, Request
from fastapi.testclient import TestClient
from pydantic import BaseModel, Field
import air
def test_air_field_with_default_value() -> None:
"""Test AirField with defau... | 25 | assert | numeric_literal | tests/test_forms.py | test_air_field_with_default_value | 465 | null | |
tableau/server-client-python | import csv
import io
from pathlib import Path
import re
from unittest.mock import patch
from pathlib import Path
from defusedxml import ElementTree as ET
import pytest
import requests_mock
import tableauserverclient as TSC
from tableauserverclient.datetime_helpers import format_datetime, parse_datetime
from tableause... | content | assert | variable | test/test_user.py | test_bulk_remove | 510 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.