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 |
|---|---|---|---|---|---|---|---|---|---|
gitlabform/gitlabform | import pytest
from gitlabform import EXIT_PROCESSING_ERROR
from gitlabform.gitlab import AccessLevel
from tests.acceptance import (
run_gitlabform,
)
class TestMembers:
def test__add_user_to_project_with_custom_role_by_id(
self, gl, group, project_for_function, outsider_user, random_string
):
... | member_role_id | assert | variable | tests/acceptance/ultimate/test_members.py | test__add_user_to_project_with_custom_role_by_id | TestMembers | 40 | null |
gitlabform/gitlabform | import pytest
from gitlab import GitlabGetError
from gitlabform.gitlab.python_gitlab import PythonGitlab
from gitlabform.gitlab import GitlabWrapper, GitLab
from unittest.mock import MagicMock, patch
class TestPythonGitlab:
def test_get_member_role_id_cached_gets_role_id_from_roles_in_group_on_saas(self):
... | int(member_role_id) | assert | func_call | tests/unit/gitlab/test_python_gitlab.py | test_get_member_role_id_cached_gets_role_id_from_roles_in_group_on_saas | TestPythonGitlab | 28 | null |
gitlabform/gitlabform | from tests.acceptance import run_gitlabform
class TestGroupVariables:
def test__more_variables(self, group_for_function):
config_more_variables = f"""
projects_and_groups:
{group_for_function.full_path}/*:
group_variables:
foo:
key: FOO
... | {"FOO", "BAR"} | assert | collection | tests/acceptance/standard/test_group_variables.py | test__more_variables | TestGroupVariables | 100 | null |
gitlabform/gitlabform | import os
import pytest
import time
from typing import cast, Tuple, Generator
from gitlab.v4.objects import Project, ProjectRemoteMirror, ProjectBranch, Group
from tests.acceptance import run_gitlabform, get_random_name, create_project
from tests.acceptance.conftest import GitLabFormLogs
def mirror_target_projects(ot... | None | assert | none_literal | tests/acceptance/standard/test_remote_mirrors.py | test_remote_mirrors_create | TestRemoteMirrorsProcessor | 152 | null |
gitlabform/gitlabform | import os
import pytest
import tempfile
import shutil
from tests.acceptance import (
run_gitlabform,
)
class TestProjectAvatar:
def setup_method(self):
# Use gitlabform logo
self.project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../.."))
self.test_image_absolute... | None | assert | none_literal | tests/acceptance/standard/test_project_avatar.py | test__project_avatar_set_absolute_path | TestProjectAvatar | 33 | null |
gitlabform/gitlabform | from tests.acceptance import run_gitlabform
class TestGroupLabels:
def test__can_add_a_label_to_group(self, gl, group_for_function):
group = gl.groups.get(group_for_function.id)
labels = group.labels.list()
assert len(labels) == 0
config_for_labels = f"""
projects_and_group... | 1 | assert | numeric_literal | tests/acceptance/standard/test_group_labels.py | test__can_add_a_label_to_group | TestGroupLabels | 23 | null |
gitlabform/gitlabform | import os
import pytest
import tempfile
import shutil
from tests.acceptance import (
run_gitlabform,
)
class TestProjectAvatar:
def setup_method(self):
# Use gitlabform logo
self.project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../.."))
self.test_image_absolute... | (None, "") | assert | collection | tests/acceptance/standard/test_project_avatar.py | test__project_avatar_error_stops_all_processing | TestProjectAvatar | 296 | null |
gitlabform/gitlabform | import pytest
import gitlab
from gitlabform.gitlab import AccessLevel
from tests.acceptance import get_only_tag_access_levels, run_gitlabform
pytestmark = pytest.mark.requires_license
class TestTags:
def test__allowed_to_create_by_user_and_role(self, project, tag, make_user):
user1 = make_user(AccessLev... | sorted([user1.id]) | assert | func_call | tests/acceptance/premium/test_tags.py | test__allowed_to_create_by_user_and_role | TestTags | 90 | null |
gitlabform/gitlabform | import pytest
from gitlabform.gitlab import AccessLevel
from tests.acceptance import (
run_gitlabform,
randomize_case,
allowed_codes,
)
def one_owner_and_two_developers(group, root_user, users):
group.members.create({"user_id": users[0].id, "access_level": AccessLevel.OWNER.value})
group.members.c... | 1 | assert | numeric_literal | tests/acceptance/standard/test_group_members_case_insensitive.py | test__user_case_insensitive | TestGroupMembersCaseInsensitive | 86 | null |
gitlabform/gitlabform | import pytest
import time
import gitlab
from gitlabform.gitlab import AccessLevel
from tests.acceptance import get_only_branch_access_levels, run_gitlabform
pytestmark = pytest.mark.requires_license
class TestBranches:
def test__allow_more_than_one_user_by_ids(self, project, branch, make_user):
first_u... | [AccessLevel.MAINTAINER.value] | assert | collection | tests/acceptance/premium/test_branches.py | test__allow_more_than_one_user_by_ids | TestBranches | 121 | null |
gitlabform/gitlabform | import textwrap
from gitlabform.processors.util.difference_logger import DifferenceLogger
def test_empty_dict_current():
current_config = dict()
config_to_apply = {
"foo": 123,
"bar": "whatever",
}
result = DifferenceLogger.log_diff("test", current_config, config_to_apply, False, None,... | expected | assert | variable | tests/unit/processors/test_difference_logger.py | test_empty_dict_current | 20 | null | |
gitlabform/gitlabform | import pytest
from tests.acceptance import run_gitlabform
pytestmark = pytest.mark.requires_license
class TestPushRules:
def test__changing_author_email_regex(self, project):
initial_regex = r"\@(?:(?:engineering\.digital\.)?co\.uk|(?:users\.)?noreply\.gitlab\.com)$"
initial_config = f"""
... | initial_regex | assert | variable | tests/acceptance/premium/test_push_rules.py | test__changing_author_email_regex | TestPushRules | 69 | null |
gitlabform/gitlabform | import pytest
from tests.acceptance import run_gitlabform
pytestmark = pytest.mark.requires_license
class TestGroupSettings:
def test__can_set_file_template_project_id(self, gl, project, group):
assert "file_template_project_id" not in group.attributes
edit_group_settings = f"""
projects... | project.id | assert | complex_expr | tests/acceptance/premium/test_group_settings.py | test__can_set_file_template_project_id | TestGroupSettings | 22 | null |
gitlabform/gitlabform | import pytest
from gitlabform import EXIT_INVALID_INPUT
from gitlabform.configuration import Configuration
def test__config_with_different_case_group():
group_name_with_varying_case = "GROUPnameWITHvaryingCASE"
config_yaml = f"""
projects_and_groups:
{group_name_with_varying_case}/*:
projec... | {"visibility": "internal"} | assert | collection | tests/unit/configuration/test_case_sensitivity.py | test__config_with_different_case_group | 21 | null | |
gitlabform/gitlabform | import pytest
import gitlab
from gitlabform.gitlab import AccessLevel
from tests.acceptance import get_only_tag_access_levels, run_gitlabform
pytestmark = pytest.mark.requires_license
class TestTags:
def test__allowed_to_create_by_user_only(self, project, tag, make_user):
user1 = make_user(AccessLevel.DE... | sorted([user1.id, user2.id]) | assert | func_call | tests/acceptance/premium/test_tags.py | test__allowed_to_create_by_user_only | TestTags | 35 | null |
gitlabform/gitlabform | import pytest
from gitlab import GitlabGetError
from gitlabform.gitlab.python_gitlab import PythonGitlab
from gitlabform.gitlab import GitlabWrapper, GitLab
from unittest.mock import MagicMock, patch
class TestGitlabWrapperExtraKwargs:
@patch("gitlabform.gitlab.GraphQL")
@patch("gitlabform.gitlab.PythonGitla... | True | assert | bool_literal | tests/unit/gitlab/test_python_gitlab.py | test_only_valid_gitlab_client_params_passed | TestGitlabWrapperExtraKwargs | 133 | null |
gitlabform/gitlabform | import pytest
from tests.acceptance import run_gitlabform
pytestmark = pytest.mark.requires_license
class TestPushRules:
def test__changing_author_email_regex(self, project):
initial_regex = r"\@(?:(?:engineering\.digital\.)?co\.uk|(?:users\.)?noreply\.gitlab\.com)$"
initial_config = f"""
... | updated_regex | assert | variable | tests/acceptance/premium/test_push_rules.py | test__changing_author_email_regex | TestPushRules | 90 | null |
gitlabform/gitlabform | import logging
import pytest
from typing import TYPE_CHECKING
from gitlab.v4.objects import GroupHook
from tests.acceptance import run_gitlabform, get_random_name
def urls():
first_name = get_random_name("hook")
second_name = get_random_name("hook")
third_name = get_random_name("hook")
first_url = f"h... | caplog.text | assert | complex_expr | tests/acceptance/standard/test_group_hooks.py | test_hooks_delete | TestGroupHooksProcessor | 171 | null |
gitlabform/gitlabform | import pytest
from gitlab import GitlabGetError, GitlabListError
from gitlabform.gitlab.core import UnexpectedResponseException, NotFoundException
from tests.acceptance import run_gitlabform
class TestVariables:
def test__variable_with_env_scope(self, project):
config_more_variables = f"""
proje... | "alfa" | assert | string_literal | tests/acceptance/standard/test_variables.py | test__variable_with_env_scope | TestVariables | 159 | null |
gitlabform/gitlabform | import logging
import pytest
from gitlabform.configuration import Configuration
logger = logging.getLogger(__name__)
def configuration_with_only_group_and_project():
config_yaml = """
---
projects_and_groups:
some_group/*:
project_settings:
foo: bar
hooks:
a:
... | {"foo": "bar", "bar": "foo"} | assert | collection | tests/unit/configuration/test_projects_and_groups.py | test__get_effective_config_for_project__project_from_config__additive_project_settings | 52 | null | |
gitlabform/gitlabform | import pytest
from gitlabform.processors.project import schedules_processor
@pytest.mark.parametrize(
("project_id", "cron", "expected"),
[
(1, "* * * * *", "* * * * *"),
(1, "@HOURLY", "8 * * * *"),
(1, "H * * * *", "8 * * * *"),
(1, "@daily", "8 18 * * *"),
(1, "H H *... | expected | assert | variable | tests/unit/processors/test_schedules_processor_extended_cron_pattern.py | test_cron_expressions | 31 | null | |
gitlabform/gitlabform | import pytest
import time
import gitlab
from gitlabform.gitlab import AccessLevel
from tests.acceptance import get_only_branch_access_levels, run_gitlabform
pytestmark = pytest.mark.requires_license
class TestBranches:
def test__allow_more_than_one_user_by_ids(self, project, branch, make_user):
first_u... | [] | assert | collection | tests/acceptance/premium/test_branches.py | test__allow_more_than_one_user_by_ids | TestBranches | 130 | null |
gitlabform/gitlabform | import logging
import pytest
from typing import TYPE_CHECKING
from gitlab.v4.objects import GroupHook
from tests.acceptance import run_gitlabform, get_random_name
def urls():
first_name = get_random_name("hook")
second_name = get_random_name("hook")
third_name = get_random_name("hook")
first_url = f"h... | ( True, True, ) | assert | collection | tests/acceptance/standard/test_group_hooks.py | test_hooks_create | TestGroupHooksProcessor | 59 | null |
gitlabform/gitlabform | import logging
import pytest
from gitlabform.configuration import Configuration
logger = logging.getLogger(__name__)
def configuration_for_skip_groups_skip_projects():
config_yaml = """
---
projects_and_groups:
"*":
group_settings:
one: two
project_settings:
thre... | is_skipped | assert | variable | tests/unit/configuration/test_skip_groups_skip_projects.py | test__config_skip_project | 57 | null | |
gitlabform/gitlabform | from tests.acceptance import run_gitlabform
class TestGroupLabels:
def test__can_add_a_label_to_group(self, gl, group_for_function):
group = gl.groups.get(group_for_function.id)
labels = group.labels.list()
assert len(labels) == 0
config_for_labels = f"""
projects_and_group... | "#FF0000" | assert | string_literal | tests/acceptance/standard/test_group_labels.py | test__can_add_a_label_to_group | TestGroupLabels | 30 | null |
gitlabform/gitlabform | import pytest
from tests.acceptance import allowed_codes, run_gitlabform
from gitlabform.gitlab import AccessLevel
from gitlabform.constants import APPROVAL_RULE_NAME
pytestmark = pytest.mark.requires_license
def group_with_one_owner_and_two_developers(other_group, root_user, users):
other_group.members.create({... | 0 | assert | numeric_literal | tests/acceptance/premium/test_merge_request_approvers.py | test__only_users | TestMergeRequestApprovers | 85 | null |
gitlabform/gitlabform | import pytest
from gitlabform import EXIT_PROCESSING_ERROR
from gitlabform.gitlab import AccessLevel
from tests.acceptance import run_gitlabform
class TestGroupMembers:
def test__cannot_add_user_to_group_members_with_custom_role_where_custom_role_does_not_exist(
self, gl, group_for_function, users, rando... | SystemExit | assert | variable | tests/acceptance/ultimate/test_group_members.py | test__cannot_add_user_to_group_members_with_custom_role_where_custom_role_does_not_exist | TestGroupMembers | 107 | null |
gitlabform/gitlabform | import pytest
from gitlabform import EXIT_PROCESSING_ERROR
from gitlabform.gitlab import AccessLevel
from tests.acceptance import run_gitlabform
class TestGroupMembers:
def test__add_user_to_group_members_with_custom_role_by_id(self, gl, group_for_function, users, random_string):
base_access_level = Acces... | users[0].get_id() | assert | func_call | tests/acceptance/ultimate/test_group_members.py | test__add_user_to_group_members_with_custom_role_by_id | TestGroupMembers | 31 | null |
gitlabform/gitlabform | from tests.acceptance import run_gitlabform
from gitlabform.processors.project.project_security_settings import (
ProjectSecuritySettingsProcessor,
)
class TestProjectSecuritySettings:
def test__secret_push_protection_project_security_settings(self, gl, project):
config = f"""
projects_and_gro... | True | assert | bool_literal | tests/acceptance/ultimate/test_project_security_settings.py | test__secret_push_protection_project_security_settings | TestProjectSecuritySettings | 22 | null |
gitlabform/gitlabform | import pytest
from tests.acceptance import run_gitlabform
pytestmark = pytest.mark.requires_license
class TestPushRules:
def test__edit_push_rules(self, project):
self.test__create_push_rules(project)
config = f"""
projects_and_groups:
{project.path_with_namespace}:
... | 2 | assert | numeric_literal | tests/acceptance/premium/test_push_rules.py | test__edit_push_rules | TestPushRules | 49 | null |
gitlabform/gitlabform | import os
import pytest
import tempfile
import shutil
from tests.acceptance import (
run_gitlabform,
)
class TestGroupAvatar:
def setup_method(self):
# Use gitlabform logo
self.project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../.."))
self.test_image_absolute_p... | (None, "") | assert | collection | tests/acceptance/standard/test_group_avatar.py | test__group_avatar_error_stops_all_processing | TestGroupAvatar | 293 | null |
gitlabform/gitlabform | from gitlabform.gitlab import AccessLevel
def test_sortability_of_access_levels():
sorted_group_access_levels = sorted(AccessLevel)
assert sorted_group_access_levels[0] == AccessLevel.NO_ACCESS.value
assert sorted_group_access_levels[-1] == | AccessLevel.ADMIN.value | assert | complex_expr | tests/unit/test_access_levels.py | test_sortability_of_access_levels | 19 | null | |
gitlabform/gitlabform | import pytest
import time
from gitlabform.gitlab import AccessLevel
from tests.acceptance import (
run_gitlabform,
randomize_case,
get_only_branch_access_levels,
)
pytestmark = pytest.mark.requires_license
class TestBranchesUsersCaseInsensitive:
def test__users_case_insensitive(
self,
... | [] | assert | collection | tests/acceptance/premium/test_branches_users_case_insensitive.py | test__users_case_insensitive | TestBranchesUsersCaseInsensitive | 63 | null |
gitlabform/gitlabform | import pytest
from gitlabform import EXIT_PROCESSING_ERROR
from gitlabform.gitlab import AccessLevel
from tests.acceptance import run_gitlabform
class TestGroupMembers:
def test__cannot_add_user_to_group_members_with_custom_role_where_custom_role_does_not_exist(
self, gl, group_for_function, users, rando... | SystemExit) | pytest.raises | variable | tests/acceptance/ultimate/test_group_members.py | test__cannot_add_user_to_group_members_with_custom_role_where_custom_role_does_not_exist | TestGroupMembers | 104 | null |
gitlabform/gitlabform | import logging
import pytest
from typing import TYPE_CHECKING
from gitlab.v4.objects import ProjectHook
from tests.acceptance import run_gitlabform, get_random_name
def urls():
first_name = get_random_name("hook")
second_name = get_random_name("hook")
third_name = get_random_name("hook")
first_url = f... | 2 | assert | numeric_literal | tests/acceptance/standard/test_hooks.py | test_hooks_delete | TestHooksProcessor | 161 | null |
gitlabform/gitlabform | import os
import pytest
import time
from gitlab import GitlabGetError
from gitlabform.gitlab import AccessLevel
from tests.acceptance import (
get_only_branch_access_levels,
run_gitlabform,
DEFAULT_README,
)
def no_access_branch(project):
branch = project.branches.create({"branch": "no_access_branch"... | DEFAULT_README | assert | variable | tests/acceptance/standard/test_files.py | test__set_file_specific_branch | TestFiles | 85 | null |
gitlabform/gitlabform | import pytest
import time
import gitlab
from gitlabform.gitlab import AccessLevel
from tests.acceptance import get_only_branch_access_levels, run_gitlabform
pytestmark = pytest.mark.requires_license
class TestBranches:
def test__allow_user_ids(self, project, branch, make_user):
user_allowed_to_push = m... | [AccessLevel.DEVELOPER.value] | assert | collection | tests/acceptance/premium/test_branches.py | test__allow_user_ids | TestBranches | 75 | null |
gitlabform/gitlabform | from tests.acceptance import (
run_gitlabform,
)
class TestGroupBadges:
def test__badges_delete(self, group):
config = f"""
projects_and_groups:
{group.full_path}/*:
group_badges:
pipeline-status:
name: "Group Badge"
link_url:... | 0 | assert | numeric_literal | tests/acceptance/standard/test_group_badges.py | test__badges_delete | TestGroupBadges | 50 | null |
gitlabform/gitlabform | import pytest
from gitlabform.gitlab import AccessLevel
from tests.acceptance import allowed_codes, run_gitlabform
pytestmark = pytest.mark.requires_license
def group_with_one_owner_and_two_developers(other_group, root_user, users):
other_group.members.create({"user_id": users[0].id, "access_level": AccessLevel.... | 1 | assert | numeric_literal | tests/acceptance/premium/test_merge_request_approval_rules.py | test__add_single_rule | TestMergeRequestApprovers | 50 | null |
gitlabform/gitlabform | import os
import pytest
import time
from typing import cast, Tuple, Generator
from gitlab.v4.objects import Project, ProjectRemoteMirror, ProjectBranch, Group
from tests.acceptance import run_gitlabform, get_random_name, create_project
from tests.acceptance.conftest import GitLabFormLogs
def mirror_target_projects(ot... | mirrors_after | assert | variable | tests/acceptance/standard/test_remote_mirrors.py | test_remote_mirrors_enforce_false | TestRemoteMirrorsProcessor | 608 | null |
gitlabform/gitlabform | import pytest
from gitlabform.gitlab import AccessLevel
from tests.acceptance import (
allowed_codes,
run_gitlabform,
)
def one_owner(root_user, group, groups, subgroup, users):
group.members.create({"user_id": users[0].id, "access_level": AccessLevel.OWNER.value})
group.members.delete(root_user.id)
... | 1 | assert | numeric_literal | tests/acceptance/standard/test_group_members_groups.py | test__subgroup | TestGroupMembersGroups | 84 | null |
gitlabform/gitlabform | from gitlabform.gitlab import AccessLevel
from tests.acceptance import get_only_branch_access_levels, run_gitlabform
class TestBranches:
def test__protect_and_unprotect(self, project, branch):
config_protect_branch = f"""
projects_and_groups:
{project.path_with_namespace}:
bra... | [] | assert | collection | tests/acceptance/standard/test_branches.py | test__protect_and_unprotect | TestBranches | 31 | null |
gitlabform/gitlabform | import pytest
from gitlabform.gitlab import AccessLevel
from tests.acceptance import (
run_gitlabform,
)
def tags(project):
tag_names = [
"tag1",
"tag2",
"tag3",
]
tags = []
for tag_name in tag_names:
tag = project.tags.create({"tag_name": tag_name, "ref": "main"})... | "tag*" | assert | string_literal | tests/acceptance/standard/test_tags.py | test__protect_wildcard_tag | TestTags | 75 | null |
gitlabform/gitlabform | import pytest
from gitlabform import EXIT_PROCESSING_ERROR
from gitlabform.gitlab import AccessLevel
from tests.acceptance import (
run_gitlabform,
)
class TestMembers:
def test__cannot_add_user_to_project_with_custom_role_where_custom_role_does_not_exist(
self, gl, group, project_for_function, outsi... | captured.err | assert | complex_expr | tests/acceptance/ultimate/test_members.py | test__cannot_add_user_to_project_with_custom_role_where_custom_role_does_not_exist | TestMembers | 129 | null |
gitlabform/gitlabform | import pytest
from gitlabform.gitlab import AccessLevel
from tests.acceptance import (
run_gitlabform,
)
def bot_member(gl, make_project_access_token, project_for_function):
token = make_project_access_token(target_project=project_for_function)
bot_member = gl.users.get(token.user_id)
yield bot_memb... | bot_member.username | assert | complex_expr | tests/acceptance/standard/test_members_enforce.py | test__enforce_keep_bots | TestMembersEnforce | 78 | null |
gitlabform/gitlabform | from tests.acceptance import (
get_random_suffix,
run_gitlabform,
)
from gitlabform.gitlab import AccessLevel
from gitlab import GitlabTransferProjectError
import re
import pytest
class TestTransferProject:
@pytest.mark.skip(reason="Need to wait till exception handling with custom message is implemented."... | SystemExit) | pytest.raises | variable | tests/acceptance/standard/test_transfer_project.py | test__transfer_without_satisfied_prerequisites | TestTransferProject | 264 | null |
gitlabform/gitlabform | import pytest
from tests.acceptance import (
run_gitlabform,
)
from pathlib import Path
from ruamel.yaml import YAML
class TestRunning:
def test__ALL_DEFINED(self, gl, project, other_project):
config = f"""
projects_and_groups:
{project.path_with_namespace}:
project_setti... | "foobar" | assert | string_literal | tests/acceptance/standard/test_running.py | test__ALL_DEFINED | TestRunning | 76 | null |
gitlabform/gitlabform | import logging
import pytest
from typing import TYPE_CHECKING
from gitlab.v4.objects import GroupHook
from tests.acceptance import run_gitlabform, get_random_name
def urls():
first_name = get_random_name("hook")
second_name = get_random_name("hook")
third_name = get_random_name("hook")
first_url = f"h... | third_hook_before_test.asdict() | assert | func_call | tests/acceptance/standard/test_group_hooks.py | test_hooks_delete | TestGroupHooksProcessor | 167 | null |
gitlabform/gitlabform | import pytest
from gitlab import GitlabGetError
from tests.acceptance import allowed_codes, run_gitlabform
def integrations(project):
integrations = ["asana", "slack", "redmine", "jira", "mattermost"]
yield integrations
# disable test integrations
for integration in integrations:
with allowe... | True | assert | bool_literal | tests/acceptance/standard/test_integrations.py | test__if_push_events_true_works | TestIntegrations | 107 | null |
gitlabform/gitlabform | from tests.acceptance import run_gitlabform
class TestGroupSettings:
def test__edit_settings(self, gl, group):
assert group.description != "foobar"
edit_group_settings = f"""
projects_and_groups:
{group.full_path}/*:
group_settings:
description: foobar
... | "internal" | assert | string_literal | tests/acceptance/standard/test_group_settings.py | test__edit_settings | TestGroupSettings | 18 | null |
gitlabform/gitlabform | import pytest
from tests.acceptance import run_gitlabform
pytestmark = pytest.mark.requires_license
class TestPushRules:
def test__create_push_rules(self, project):
config = f"""
projects_and_groups:
{project.path_with_namespace}:
project_push_rules:
commit_mes... | 0 | assert | numeric_literal | tests/acceptance/premium/test_push_rules.py | test__create_push_rules | TestPushRules | 27 | 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_current_url_abs_path() -> None:
app = Air()
@app.get("/test")
def current_url_abs_path(request: Request) -> H1:
return H1(f"Abs path: {re... | "<h1>Abs path: None</h1>" | assert | string_literal | tests/test_requests.py | test_htmx_current_url_abs_path | 106 | 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... | 2 | assert | numeric_literal | tests/tags/test_base_tag.py | test_counts_return_lengths | 267 | 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_input_boolean_attributes() ->... | '<input name="email">' | assert | string_literal | tests/tags/test_tags.py | test_input_boolean_attributes | 354 | null | |
feldroy/air | from typing import NoReturn
import pytest
from fastapi.exceptions import HTTPException as FastAPIHTTPException
from fastapi.testclient import TestClient
import air
@pytest.mark.parametrize(
("status", "detail"),
[
(400, "bad request"),
(401, {"msg": "unauthorized", "code": "UNAUTH"}),
... | detail | assert | variable | tests/test_exceptions.py | test_fastapi_integration_various_details | 35 | 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_atag_no_attrs_no_children() -... | "<a></a>" | assert | string_literal | tests/tags/test_tags.py | test_atag_no_attrs_no_children | 20 | 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_... | "hello world" | assert | string_literal | tests/tags/test_tags_utils.py | test_extract_html_comment_with_whitespace | 172 | 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... | 418 | assert | numeric_literal | tests/test_exceptions.py | test_init_signature_compat | 12 | 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"
first_time... | first_timestamp | assert | variable | examples/src/middleware__SessionMiddleware__test.py | test_session_persistence | 18 | 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 | numeric_literal | examples/src/applications__Air__post__test.py | test_submit_form | 13 | 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_with_standard_field() -> None:
"""Test HTML5 valid... | 2 | assert | numeric_literal | tests/test_forms.py | test_html5_validation_with_standard_field | 528 | null | |
feldroy/air | from fastapi.testclient import TestClient
from .middleware__SessionMiddleware import app
def test_session_reset() -> None:
client = TestClient(app)
response = client.get("/")
assert response.status_code == 200
first_timestamp = response.text
response = client.get("/reset")
assert response.st... | second_timestamp | assert | variable | examples/src/middleware__SessionMiddleware__test.py | test_session_reset | 34 | 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 | numeric_literal | examples/src/forms__AirForm__render__test.py | test_contact_form_renders | 13 | 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_safestr() -> None:
asser... | "'test'" | assert | string_literal | tests/tags/test_tags.py | test_safestr | 288 | null | |
feldroy/air | from fastapi.testclient import TestClient
from .forms__AirForm__widget import app
client = TestClient(app)
def test_contact_page_renders_custom_widget() -> None:
"""The GET /contact page should render the custom widget wrapper."""
response = client.get("/contact")
assert response.status_code == | 200 | assert | numeric_literal | examples/src/forms__AirForm__widget__test.py | test_contact_page_renders_custom_widget | 13 | 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_single_word_endpoint() -> None:
actual_path = compute_page_path(endpoint_name="home")
assert actua... | "/home" | assert | string_literal | tests/test_utils.py | test_compute_page_path_handles_single_word_endpoint | 21 | 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: ... | "multi_decorated" | assert | string_literal | tests/test_utils.py | test_cached_unwrap_multiple_decorators | 132 | 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... | 0.8 | assert | numeric_literal | tests/benchmarks/test_memory_tag_cleanup.py | test_nested_tag_memory_efficiency | 135 | null | |
feldroy/air | from fastapi.testclient import TestClient
from starlette.middleware.base import BaseHTTPMiddleware
from starlette.requests import Request
from starlette.responses import Response
import air
def test_session_middleware() -> None:
app = air.Air()
app.add_middleware(air.SessionMiddleware, secret_key="change-me")... | 200 | assert | numeric_literal | tests/test_middleware.py | test_session_middleware | 63 | null | |
feldroy/air | from fastapi.testclient import TestClient
from starlette.middleware.base import BaseHTTPMiddleware
from starlette.requests import Request
from starlette.responses import Response
import air
def test_middleware_with_sync_handler() -> None:
"""Middleware on the event loop works with sync handlers in a threadpool (#... | "middleware-ran" | assert | string_literal | tests/test_middleware.py | test_middleware_with_sync_handler | 34 | 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_creation_memory_scaling() -> None:
"""Test that tag creation memory usage scales linearly with object count.
Ensures ... | 2048 | assert | numeric_literal | tests/benchmarks/test_memory_tag_cleanup.py | test_tag_creation_memory_scaling | 212 | 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="... | 0 | assert | numeric_literal | tests/tags/test_stock_tags_coverage.py | test_stock_tags_comprehensive_coverage | 142 | null | |
feldroy/air | from fastapi.testclient import TestClient
from .exception_handlers__default_404_exception_handler import app
def test_exception_handling_404() -> None:
client = TestClient(app)
response = client.get("/")
assert response.status_code == 404
assert response.text == | "<p>404 Not Found</p>" | assert | string_literal | examples/src/exception_handlers__default_404_exception_handler__test.py | test_exception_handling_404 | 10 | 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_target() -> None:
app = Air()
@app.get("/test")
def target(request: Request) -> H1:
return H1(f"Target: {request.htmx.target}")
clie... | "<h1>Target: my-div</h1>" | assert | string_literal | tests/test_requests.py | test_htmx_target | 154 | null | |
feldroy/air | from typing import NoReturn
import pytest
from fastapi.exceptions import HTTPException as FastAPIHTTPException
from fastapi.testclient import TestClient
import air
@pytest.mark.parametrize(
("status", "detail"),
[
(400, "bad request"),
(401, {"msg": "unauthorized", "code": "UNAUTH"}),
... | status | assert | variable | tests/test_exceptions.py | test_fastapi_integration_various_details | 34 | 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_input_boolean_attributes() ->... | '<input name="q">' | assert | string_literal | tests/tags/test_tags.py | test_input_boolean_attributes | 326 | 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) | pytest.raises | variable | tests/tags/test_html_utils.py | test_format_html_empty_raises_parser_error | 113 | 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_... | "data-value" | assert | string_literal | tests/tags/test_tags_utils.py | test_migrate_attribute_name_to_html | 162 | 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... | TypeError) | pytest.raises | variable | tests/tags/test_base_tag.py | test_basetag_cannot_be_instantiated_directly | 63 | 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_custom_kwargs_forwarded() -> None:
... | 201 | assert | numeric_literal | tests/test_applications.py | test_custom_kwargs_forwarded | 440 | null | |
feldroy/air | from fastapi.testclient import TestClient
from .layouts__mvpcss import app
def test_index_renders_full_layout() -> None:
"""Test that index page renders full HTML layout"""
client = TestClient(app)
response = client.get("/")
assert response.status_code == 200
# Check full HTML structure
asser... | response.text | assert | complex_expr | examples/src/layouts__mvpcss__test.py | test_index_renders_full_layout | 12 | 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 ... | 1 | assert | numeric_literal | tests/test_routing.py | test_air_router_proxy_properties | 565 | 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... | "original_func" | assert | string_literal | tests/test_utils.py | test_cached_unwrap_basic | 104 | null | |
feldroy/air | from pathlib import Path
from fastapi.testclient import TestClient
from .background__BackgroundTasks import app
client = TestClient(app)
def test_send_notification() -> None:
log_file = Path("log.txt")
if log_file.exists():
log_file.unlink()
response = client.post("/send-notification/john@examp... | log_content | assert | variable | examples/src/background__BackgroundTasks__test.py | test_send_notification | 22 | 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_trigger() -> None:
app = Air()
@app.get("/test")
def trigger(request: Request) -> H1:
return H1(f"Trigger: {request.htmx.trigger}")
... | "<h1>Trigger: None</h1>" | assert | string_literal | tests/test_requests.py | test_htmx_trigger | 173 | 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_other_children_types() -> Non... | "<a>1</a>" | assert | string_literal | tests/tags/test_tags.py | test_other_children_types | 292 | 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_404_response() -> None:
app ... | 404 | assert | numeric_literal | tests/test_applications.py | test_air_404_response | 129 | 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... | captured.out | assert | complex_expr | tests/scripts/test_copy_src_example_to_callable.py | test_update_example_section_returns_false_for_missing_example_section | 143 | 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_... | ["exported"] | assert | collection | tests/tags/test_tags_utils.py | test_display_pretty_html_in_the_browser_uses_export | 379 | 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 ... | baseline | assert | variable | tests/scripts/test_missing_examples.py | test_main_baseline_mode_creates_file | 375 | 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_... | True | assert | bool_literal | tests/tags/test_tags_utils.py | fake_format_html | 182 | 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_... | 760 | assert | numeric_literal | tests/tags/test_tags_utils.py | test_compact_format_html_minifies | 193 | 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 ... | [] | assert | collection | tests/test_routing.py | test_air_router_proxy_properties | 571 | 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... | "decorated_function" | assert | string_literal | tests/benchmarks/test_inspect_caching_benchmark.py | test_unwrap_uncached_benchmark | 102 | 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_... | "_data_value_" | assert | string_literal | tests/tags/test_tags_utils.py | test_migrate_attribute_name_to_air_tag | 168 | null | |
feldroy/air | from pathlib import Path
from fastapi.testclient import TestClient
from .background__BackgroundTasks import app
client = TestClient(app)
def test_send_notification() -> None:
log_file = Path("log.txt")
if log_file.exists():
log_file.unlink()
response = client.post("/send-notification/john@examp... | 200 | assert | numeric_literal | examples/src/background__BackgroundTasks__test.py | test_send_notification | 17 | 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... | None | assert | none_literal | tests/benchmarks/test_inspect_caching_benchmark.py | test_signature_uncached_benchmark | 72 | 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"}... | response.text | assert | complex_expr | examples/src/forms__AirForm__from_request__test.py | test_from_request_with_valid_data | 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_with_none_signature_attribute() -> None:
"""Test that cached_signature handles None __signature__ gracefully."""... | None | assert | none_literal | tests/test_utils.py | test_cached_signature_with_none_signature_attribute | 80 | 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 == ... | text | assert | variable | examples/src/forms__AirField__test.py | test_contact_form_renders_with_html5_attributes | 17 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.