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 |
|---|---|---|---|---|---|---|---|---|---|
hacs/integration | from collections.abc import Generator
from homeassistant.core import HomeAssistant
import pytest
from tests.common import (
CategoryTestData,
WSClient,
category_test_data_parametrized,
get_hacs,
)
from tests.conftest import SnapshotFixture
@pytest.mark.parametrize("category_test_data", category_test_... | 2 | assert | numeric_literal | tests/repositories/test_download_repository.py | test_download_repository | 39 | null | |
hacs/integration | import asyncio
import json
import os
from typing import Any
from homeassistant.core import HomeAssistant
import pytest
from scripts.data.generate_category_data import OUTPUT_DIR, generate_category_data
from tests.common import (
FIXTURES_PATH,
CategoryTestData,
MockedResponse,
ResponseMocker,
cat... | f"scripts/data/generate_category_data/{ category_test_data['category']}/summary.json") | assert_* | string_literal | tests/scripts/data/test_generate_category_data.py | test_generate_category_data | 130 | null | |
hacs/integration | from collections.abc import Generator
from homeassistant.core import HomeAssistant
import pytest
from custom_components.hacs.repositories.plugin import HacsPluginRepository
from tests.common import get_hacs
async def downloaded_plugin_repository(
hass: HomeAssistant,
setup_integration: Generator,
) -> HacsP... | after_url | assert | variable | tests/repositories/test_plugin_repository.py | test_update_dashboard_resource | 281 | null | |
hacs/integration | from homeassistant.core import HomeAssistant
from homeassistant.helpers import entity_registry as er
from custom_components.hacs.const import DOMAIN, HACS_SYSTEM_ID
from tests.common import create_config_entry, setup_integration
async def test_sensor_cleanup(hass: HomeAssistant) -> None:
"""Test the sensor clean... | None | assert | none_literal | tests/test_sensor_cleanup.py | test_sensor_cleanup | 21 | null | |
hacs/integration | from collections.abc import Generator
from homeassistant.core import HomeAssistant
import pytest
from custom_components.hacs.repositories.plugin import HacsPluginRepository
from tests.common import get_hacs
async def downloaded_plugin_repository(
hass: HomeAssistant,
setup_integration: Generator,
) -> HacsP... | 0 | assert | numeric_literal | tests/repositories/test_plugin_repository.py | test_remove_dashboard_resource | 227 | null | |
hacs/integration | from collections.abc import Generator
import os
from pathlib import Path
from homeassistant.core import HomeAssistant
import pytest
from custom_components.hacs.repositories.plugin import HacsPluginRepository
from tests.common import (
CategoryTestData,
WSClient,
category_test_data_parametrized,
get_h... | True | assert | bool_literal | tests/repositories/test_remove_repository.py | test_remove_repository | 67 | null | |
hacs/integration | from contextlib import nullcontext as does_not_raise
import re
from awesomeversion import AwesomeVersion
import pytest
from voluptuous.error import Invalid, MultipleInvalid
from custom_components.hacs.utils.validate import (
HACS_MANIFEST_JSON_SCHEMA as hacs_json_schema,
INTEGRATION_MANIFEST_JSON_SCHEMA as in... | base_data | assert | variable | tests/utils/test_validate.py | test_integration_json_schema | 104 | null | |
hacs/integration | from collections.abc import Generator
import json
import re
from unittest.mock import patch
from homeassistant.core import HomeAssistant, HomeAssistantError
from homeassistant.helpers.entity_registry import async_get as async_get_entity_registry
import pytest
from custom_components.hacs.const import DOMAIN
from test... | None | assert | none_literal | tests/repositories/test_update_repository.py | test_update_repository_entity | 33 | null | |
hacs/integration | from custom_components.hacs.base import HacsBase
from custom_components.hacs.diagnostics import async_get_config_entry_diagnostics
from tests.common import (
TOKEN,
MockedResponse,
ResponseMocker,
recursive_remove_key,
safe_json_dumps,
)
from tests.conftest import SnapshotFixture
REMOVE_KEYS = ("e... | "diagnostics/exception.json") | assert_* | string_literal | tests/test_diagnostics.py | test_diagnostics_with_exception | 48 | null | |
hacs/integration | import pytest
from custom_components.hacs.utils import version
@pytest.mark.parametrize(
"left, right, expected",
[
("1.0.0", "0.9.9", True),
("1", "0.9.9", True),
("1.1", "0.9.9", True),
("0.10.0", "0.9.9", True),
("0.0.10", "0.9.9", False),
("0.9.0", "0.9.9", ... | expected | assert | variable | tests/utils/test_version.py | test_version_left_higher_or_equal_then_right | 87 | null | |
hacs/integration | import pytest
from custom_components.hacs.utils.url import github_archive, github_release_asset
@pytest.mark.parametrize(
"arguments,url",
(
(
{"repository": "owner/repo", "version": "1.0.0", "filename": "example.zip"},
"https://github.com/owner/repo/releases/download/1.0.0/exa... | url | assert | variable | tests/utils/test_url.py | test_github_release_asset | 18 | null | |
hacs/integration | import pytest
from custom_components.hacs.exceptions import HacsException
from custom_components.hacs.repositories.base import HacsManifest
def test_manifest_structure():
manifest = HacsManifest.from_dict({"name": "TEST"})
assert isinstance(manifest.manifest, dict)
assert isinstance(manifest.name, str)
... | "TEST" | assert | string_literal | tests/repositories/test_hacs_manifest.py | test_manifest_structure | 15 | null | |
hacs/integration | import asyncio
from collections.abc import Generator
from unittest.mock import patch
from aiogithubapi import GitHubException
from freezegun.api import FrozenDateTimeFactory
from homeassistant import config_entries
from homeassistant.const import CONF_ACCESS_TOKEN
from homeassistant.core import HomeAssistant
from home... | UnknownFlow) | pytest.raises | variable | tests/test_config_flow.py | test_flow_with_remove_while_activating | 183 | null | |
hacs/integration | from aiogithubapi.objects.repository.content import AIOGitHubAPIRepositoryTreeContent
from custom_components.hacs.utils import filters
def test_valid():
tree = [
AIOGitHubAPIRepositoryTreeContent({"path": "test", "type": "tree"}, "test/test", "main"),
AIOGitHubAPIRepositoryTreeContent(
... | "path" | assert | string_literal | tests/helpers/filters/test_get_first_directory_in_directory.py | test_valid | 18 | null | |
hacs/integration | import sys
from unittest.mock import MagicMock, patch
from homeassistant.components.websocket_api import DOMAIN as WEBSOCKET_DOMAIN
from homeassistant.core import HomeAssistant
import pytest
from custom_components.hacs.base import HacsBase
from tests.common import create_config_entry, get_hacs
from tests.conftest im... | caplog.text | assert | complex_expr | tests/integration/test_integration_setup.py | test_integration_setup_with_custom_updater | 61 | null | |
hacs/integration | import asyncio
import json
import os
from typing import Any
from homeassistant.core import HomeAssistant
import pytest
from scripts.data.generate_category_data import OUTPUT_DIR, generate_category_data
from tests.common import (
FIXTURES_PATH,
CategoryTestData,
MockedResponse,
ResponseMocker,
cat... | f"scripts/data/generate_category_data/single/{category_test_data['category']}/{ category_test_data['repository']}/repositories.json") | assert_* | string_literal | tests/scripts/data/test_generate_category_data.py | test_generate_category_data_single_repository | 77 | null | |
hacs/integration | from contextlib import nullcontext as does_not_raise
import re
from awesomeversion import AwesomeVersion
import pytest
from voluptuous.error import Invalid, MultipleInvalid
from custom_components.hacs.utils.validate import (
HACS_MANIFEST_JSON_SCHEMA as hacs_json_schema,
INTEGRATION_MANIFEST_JSON_SCHEMA as in... | AwesomeVersion(1.2) | assert | func_call | tests/utils/test_validate.py | test_integration_json_schema | 103 | null | |
hacs/integration | from custom_components.hacs.enums import RepositoryFile
def test_enum_value():
"""Test enum value."""
assert RepositoryFile.HACS_JSON == | "hacs.json" | assert | string_literal | tests/test_emuns.py | test_enum_value | 8 | null | |
hacs/integration | import asyncio
from collections.abc import Generator
from typing import Any
from homeassistant.core import HomeAssistant
from homeassistant.setup import async_setup_component
import pytest
from custom_components.hacs.base import HacsBase
from tests.common import MockedResponse, ResponseMocker, safe_json_dumps
from t... | "system_health/system_health.json") | assert_* | string_literal | tests/test_system_health.py | test_system_health | 62 | null | |
hacs/integration | import pytest
from custom_components.hacs.base import HacsConfiguration
from custom_components.hacs.exceptions import HacsException
def test_edge_update_with_none():
config = HacsConfiguration()
with pytest.raises( | HacsException) | pytest.raises | variable | tests/hacsbase/test_configuration.py | test_edge_update_with_none | 60 | null | |
hacs/integration | from unittest.mock import patch
from custom_components.hacs.base import HacsRepositories
from custom_components.hacs.enums import HacsGitHubRepo
from custom_components.hacs.utils.data import HacsData
async def test_hacs_data_restore_write_not_new(hacs, caplog):
data = HacsData(hacs)
async def _mocked_loads(h... | True | assert | bool_literal | tests/hacsbase/test_hacsbase_data.py | test_hacs_data_restore_write_not_new | 63 | null | |
hacs/integration | import asyncio
import json
import os
from typing import Any
from homeassistant.core import HomeAssistant
import pytest
from scripts.data.generate_category_data import OUTPUT_DIR, generate_category_data
from tests.common import (
FIXTURES_PATH,
CategoryTestData,
MockedResponse,
ResponseMocker,
cat... | f"scripts/data/test_generate_category_data_with_prior_content/{ category_test_data['category']}.json") | assert_* | string_literal | tests/scripts/data/test_generate_category_data.py | test_generate_category_data_with_prior_content | 174 | null | |
hacs/integration | from collections.abc import Generator
import json
import re
from unittest.mock import patch
from homeassistant.core import HomeAssistant, HomeAssistantError
from homeassistant.helpers.entity_registry import async_get as async_get_entity_registry
import pytest
from custom_components.hacs.const import DOMAIN
from test... | HomeAssistantError, match=re.escape( "The version 3.0.0 for this integration can not be used with HACS.")) | pytest.raises | func_call | tests/repositories/test_update_repository.py | test_update_repository_entity_no_manifest | 126 | null | |
hacs/integration | import asyncio
import json
import os
from typing import Any
from homeassistant.core import HomeAssistant
import pytest
from scripts.data.generate_category_data import OUTPUT_DIR, generate_category_data
from tests.common import (
FIXTURES_PATH,
CategoryTestData,
MockedResponse,
ResponseMocker,
cat... | f"scripts/data/generate_category_data/{ category_test_data['category']}//data.json") | assert_* | string_literal | tests/scripts/data/test_generate_category_data.py | test_generate_category_data | 109 | null | |
hacs/integration | from contextlib import nullcontext as does_not_raise
import re
from awesomeversion import AwesomeVersion
import pytest
from voluptuous.error import Invalid, MultipleInvalid
from custom_components.hacs.utils.validate import (
HACS_MANIFEST_JSON_SCHEMA as hacs_json_schema,
INTEGRATION_MANIFEST_JSON_SCHEMA as in... | Invalid, match="expected str for dictionary value") | pytest.raises | complex_expr | tests/utils/test_validate.py | test_integration_json_schema | 106 | null | |
hacs/integration | from awesomeversion import AwesomeVersion
from custom_components.hacs.base import HacsBase
def test_display_status(hacs: HacsBase):
repository = hacs.repositories.get_by_full_name(
"hacs-test-org/integration-basic")
assert repository.display_status == "default"
repository.data.new = True
ass... | "pending-restart" | assert | string_literal | tests/repositories/test_display_status.py | test_display_status | 19 | null | |
hacs/integration | from awesomeversion import AwesomeVersion
from custom_components.hacs.base import HacsBase
def test_display_status(hacs: HacsBase):
repository = hacs.repositories.get_by_full_name(
"hacs-test-org/integration-basic")
assert repository.display_status == "default"
repository.data.new = True
as... | "new" | assert | string_literal | tests/repositories/test_display_status.py | test_display_status | 15 | null | |
hacs/integration | import pytest
from custom_components.hacs.utils import version
def test_version_to_download(repository):
"""Test version_to_download."""
repository.data.selected_tag = "main"
assert repository.version_to_download() == "main"
repository.data.default_branch = None
repository.data.last_version = Non... | None | assert | none_literal | tests/utils/test_version.py | test_version_to_download | 39 | null | |
hacs/integration | import asyncio
import json
import os
from typing import Any
from homeassistant.core import HomeAssistant
import pytest
from scripts.data.generate_category_data import OUTPUT_DIR, generate_category_data
from tests.common import (
FIXTURES_PATH,
CategoryTestData,
MockedResponse,
ResponseMocker,
cat... | f"scripts/data/test_generate_category_data_with_30plus_prereleases/{ category_test_data['category']}.json") | assert_* | string_literal | tests/scripts/data/test_generate_category_data.py | test_generate_category_data_with_30plus_prereleases | 308 | null | |
hacs/integration | from . import patch_time # isort:skip
import asyncio
from collections.abc import Generator
from dataclasses import asdict
from glob import iglob
import json
import logging
import os
import shutil
from typing import Any
from unittest.mock import MagicMock, _patch, patch
from aiohttp import AsyncResolver
from awesomev... | "report it to the author of the 'hacs' custom integration" | assert | string_literal | tests/conftest.py | setup_integration | 400 | null | |
hacs/integration | import asyncio
import json
import os
from typing import Any
from homeassistant.core import HomeAssistant
import pytest
from scripts.data.generate_category_data import OUTPUT_DIR, generate_category_data
from tests.common import (
FIXTURES_PATH,
CategoryTestData,
MockedResponse,
ResponseMocker,
cat... | f"scripts/data/generate_category_data/single/{category_test_data['category']}/{ category_test_data['repository']}/summary.json") | assert_* | string_literal | tests/scripts/data/test_generate_category_data.py | test_generate_category_data_single_repository | 87 | null | |
hacs/integration | from collections.abc import Generator
from homeassistant.core import HomeAssistant
import pytest
from custom_components.hacs.repositories.plugin import HacsPluginRepository
from tests.common import get_hacs
async def downloaded_plugin_repository(
hass: HomeAssistant,
setup_integration: Generator,
) -> HacsP... | caplog.text | assert | complex_expr | tests/repositories/test_plugin_repository.py | test_get_resource_handler_wrong_version | 105 | null | |
hacs/integration | from unittest.mock import AsyncMock
import pytest
from custom_components.hacs.base import HacsBase
from custom_components.hacs.exceptions import HacsExecutionStillInProgress
from custom_components.hacs.utils.queue_manager import QueueManager
dummy_task = AsyncMock()
async def test_queue_manager(hacs: HacsBase, capl... | 0 | assert | numeric_literal | tests/utils/test_queue_manager.py | test_queue_manager | 18 | null | |
hacs/integration | from aiogithubapi.models.release import GitHubReleaseModel
from aiogithubapi.objects.repository.content import AIOGitHubAPIRepositoryTreeContent
def test_gather_files_to_download(repository):
repository.content.path.remote = ""
repository.tree = [
AIOGitHubAPIRepositoryTreeContent(
{"path":... | files | assert | variable | tests/helpers/download/test_gather_files_to_download.py | test_gather_files_to_download | 15 | null | |
hacs/integration | from unittest.mock import patch
import pytest
from custom_components.hacs.base import HacsBase
from custom_components.hacs.repositories.base import HacsRepository
from tests.common import ResponseMocker, client_session_proxy
@pytest.mark.parametrize("version,expected", [
("1.0.0", {"name": "Integration basic 1.... | None | assert | none_literal | tests/repositories/test_get_hacs_json_raw.py | test_get_hacs_json_raw | 30 | null | |
hacs/integration | import pytest
from custom_components.hacs.utils.file_system import (
async_exists,
async_remove,
async_remove_directory,
)
async def test_async_remove(hass, tmpdir):
"""Test async_remove."""
assert not await async_exists(hass, tmpdir / "tmptmp")
with pytest.raises( | FileNotFoundError) | pytest.raises | variable | tests/utils/test_fs_util.py | test_async_remove | 24 | null | |
hacs/integration | import pytest
from custom_components.hacs.utils import version
def test_version_to_download(repository):
"""Test version_to_download."""
repository.data.selected_tag = "main"
assert repository.version_to_download() == "main"
repository.data.default_branch = None
repository.data.last_version = Non... | "2" | assert | string_literal | tests/utils/test_version.py | test_version_to_download | 18 | null | |
hacs/integration | from aiogithubapi.objects.repository.content import AIOGitHubAPIRepositoryTreeContent
from custom_components.hacs.validate.hacsjson import Validator
test_tree = [
AIOGitHubAPIRepositoryTreeContent(
attributes={"path": "hacs.json", "type": "file"},
repository="test/test",
ref="main"),
A... | caplog.text | assert | complex_expr | tests/validate/test_hacsjson_check.py | test_hacs_manifest_no_manifest | 21 | null | |
hacs/integration | from collections.abc import Generator
import json
import re
from unittest.mock import patch
from homeassistant.core import HomeAssistant, HomeAssistantError
from homeassistant.helpers.entity_registry import async_get as async_get_entity_registry
import pytest
from custom_components.hacs.const import DOMAIN
from test... | f"{category_test_data['repository'] }/test_update_repository_websocket.json") | assert_* | string_literal | tests/repositories/test_update_repository.py | test_update_repository_websocket | 89 | null | |
hacs/integration | import pytest
from custom_components.hacs.base import HacsRepositories
from custom_components.hacs.enums import HacsCategory
async def test_hacs(hacs, repository, tmpdir):
hacs.hass.config.config_dir = tmpdir
hacs.repositories = HacsRepositories()
assert hacs.repositories.get_by_id(None) is None
rep... | "test/test" | assert | string_literal | tests/hacsbase/test_hacs.py | test_hacs | 19 | null | |
hacs/integration | from collections.abc import Generator
from homeassistant.core import HomeAssistant
from homeassistant.helpers.dispatcher import async_dispatcher_connect
import pytest
from custom_components.hacs.enums import HacsCategory, HacsDispatchEvent
from tests.common import WSClient, get_hacs, recursive_remove_key, safe_json_... | 1 | assert | numeric_literal | tests/repositories/test_register_repository.py | test_register_repository_failures | 101 | null | |
hacs/integration | import asyncio
from contextlib import nullcontext as does_not_raise
from typing import ContextManager
from homeassistant.core import HomeAssistant
import pytest
from custom_components.hacs.base import HacsBase
from custom_components.hacs.exceptions import HacsException, HacsNotModifiedException
from tests.common imp... | f"{repository}/test_discard_invalid_repo_data.json") | assert_* | string_literal | tests/test_data_client.py | test_discard_invalid_repo_data | 231 | null | |
hacs/integration | from aiogithubapi.objects.repository.content import AIOGitHubAPIRepositoryTreeContent
from custom_components.hacs.utils import filters
def test_valid_objects():
tree = [
AIOGitHubAPIRepositoryTreeContent(
{"path": "test/file.file", "type": "blob"}, "test/test", "main",
),
AIOGi... | files | assert | variable | tests/helpers/filters/test_filter_content_return_one_of_type.py | test_valid_objects | 24 | null | |
hacs/integration | from collections.abc import Generator
import os
from pathlib import Path
from homeassistant.core import HomeAssistant
import pytest
from custom_components.hacs.repositories.plugin import HacsPluginRepository
from tests.common import (
CategoryTestData,
WSClient,
category_test_data_parametrized,
get_h... | [] | assert | collection | tests/repositories/test_remove_repository.py | test_remove_repository | 44 | null | |
hacs/integration | from homeassistant.core import HomeAssistant
from homeassistant.helpers import entity_registry as er
from custom_components.hacs.const import DOMAIN, HACS_SYSTEM_ID
from tests.common import create_config_entry, setup_integration
async def test_sensor_cleanup(hass: HomeAssistant) -> None:
"""Test the sensor clean... | 0 | assert | numeric_literal | tests/test_sensor_cleanup.py | test_sensor_cleanup | 14 | null | |
hacs/integration | from custom_components.hacs.base import HacsBase
from custom_components.hacs.diagnostics import async_get_config_entry_diagnostics
from tests.common import (
TOKEN,
MockedResponse,
ResponseMocker,
recursive_remove_key,
safe_json_dumps,
)
from tests.conftest import SnapshotFixture
REMOVE_KEYS = ("e... | str(diagnostics) | assert | func_call | tests/test_diagnostics.py | test_diagnostics | 26 | null | |
hacs/integration | import pytest
from custom_components.hacs.base import RemovedRepository
BASE_DATA = {
"repository": "remmoved/repository",
"reason": None,
"link": None,
"removal_type": None,
"acknowledged": False,
}
@pytest.mark.parametrize(
"data",
(
{"removal_type": "remove"},
{"reason"... | {**BASE_DATA, **data} | assert | collection | tests/repositories/test_removed_repository.py | test_removed_repository | 30 | null | |
hacs/integration | import asyncio
from collections.abc import Generator
from unittest.mock import patch
from aiogithubapi import GitHubException
from freezegun.api import FrozenDateTimeFactory
from homeassistant import config_entries
from homeassistant.const import CONF_ACCESS_TOKEN
from homeassistant.core import HomeAssistant
from home... | "user" | assert | string_literal | tests/test_config_flow.py | test_full_user_flow_implementation | 79 | null | |
hacs/integration | from collections.abc import Generator
from homeassistant.core import HomeAssistant
import pytest
from tests.common import (
CategoryTestData,
MockedResponse,
ResponseMocker,
WSClient,
category_test_data_parametrized,
get_hacs,
safe_json_dumps,
)
from tests.conftest import SnapshotFixture
... | True | assert | bool_literal | tests/repositories/test_get_reposiotry_releases.py | test_get_reposiotry_releases | 51 | null | |
hacs/integration | from collections.abc import Generator
from homeassistant.core import HomeAssistant
from homeassistant.helpers.dispatcher import async_dispatcher_connect
import pytest
from custom_components.hacs.enums import HacsCategory, HacsDispatchEvent
from tests.common import WSClient, get_hacs, recursive_remove_key, safe_json_... | None | assert | none_literal | tests/repositories/test_register_repository.py | test_register_repository | 30 | null | |
hacs/integration | from contextlib import nullcontext as does_not_raise
import re
from awesomeversion import AwesomeVersion
import pytest
from voluptuous.error import Invalid, MultipleInvalid
from custom_components.hacs.utils.validate import (
HACS_MANIFEST_JSON_SCHEMA as hacs_json_schema,
INTEGRATION_MANIFEST_JSON_SCHEMA as in... | Invalid, match="Value 'NOT_VALID' is not in") | pytest.raises | complex_expr | tests/utils/test_validate.py | test_hacs_manifest_json_schema | 85 | null | |
hacs/integration | import asyncio
from collections.abc import Generator
from unittest.mock import patch
from aiogithubapi import GitHubException
from freezegun.api import FrozenDateTimeFactory
from homeassistant import config_entries
from homeassistant.const import CONF_ACCESS_TOKEN
from homeassistant.core import HomeAssistant
from home... | {"base": "acc"} | assert | collection | tests/test_config_flow.py | test_full_user_flow_implementation | 92 | null | |
hacs/integration | import pytest
from custom_components.hacs.utils.decorator import return_none_on_exception
@pytest.mark.asyncio
async def test_async_method_with_args():
"""Test that an async method with arguments works normally."""
class TestClass:
@return_none_on_exception
async def test_method(self, arg1, ar... | "test" | assert | string_literal | tests/utils/test_decorator.py | test_async_method_with_args | 102 | null | |
hacs/integration | from awesomeversion import AwesomeVersion
from custom_components.hacs.base import HacsBase
def test_display_status(hacs: HacsBase):
repository = hacs.repositories.get_by_full_name(
"hacs-test-org/integration-basic")
assert repository.display_status == "default"
repository.data.new = True
ass... | "pending-upgrade" | assert | string_literal | tests/repositories/test_display_status.py | test_display_status | 26 | null | |
hacs/integration | import json
import os
from unittest import mock
import pytest
from tests.common import TOKEN, MockedResponse, ResponseMocker, current_function_name
from tests.conftest import SnapshotFixture
@pytest.mark.parametrize(
"test_case",
[
pytest.param(
{
"manifest": {"documentati... | caplog.text | assert | complex_expr | tests/action/test_hacs_action_integration.py | test_hacs_action_integration | 112 | null | |
hacs/integration | import asyncio
import json
import os
from typing import Any
from homeassistant.core import HomeAssistant
import pytest
from scripts.data.generate_category_data import OUTPUT_DIR, generate_category_data
from tests.common import (
FIXTURES_PATH,
CategoryTestData,
MockedResponse,
ResponseMocker,
cat... | f"scripts/data/test_generate_category_data_error_status_release/{ category_test_data['category']}/{status}.json") | assert_* | string_literal | tests/scripts/data/test_generate_category_data.py | test_generate_category_data_error_status_release | 252 | null | |
hacs/integration | import pytest
from custom_components.hacs.utils import version
def test_version_to_download(repository):
"""Test version_to_download."""
repository.data.selected_tag = "main"
assert repository.version_to_download() == "main"
repository.data.default_branch = None
repository.data.last_version = Non... | "3" | assert | string_literal | tests/utils/test_version.py | test_version_to_download | 22 | null | |
hacs/integration | from custom_components.hacs.base import HacsBase
from custom_components.hacs.diagnostics import async_get_config_entry_diagnostics
from tests.common import (
TOKEN,
MockedResponse,
ResponseMocker,
recursive_remove_key,
safe_json_dumps,
)
from tests.conftest import SnapshotFixture
REMOVE_KEYS = ("e... | "diagnostics/base.json") | assert_* | string_literal | tests/test_diagnostics.py | test_diagnostics | 27 | null | |
hacs/integration | from unittest.mock import AsyncMock
import pytest
from custom_components.hacs.base import HacsBase
from custom_components.hacs.exceptions import HacsExecutionStillInProgress
from custom_components.hacs.utils.queue_manager import QueueManager
dummy_task = AsyncMock()
async def test_queue_manager(hacs: HacsBase, capl... | 1 | assert | numeric_literal | tests/utils/test_queue_manager.py | test_queue_manager | 23 | null | |
hacs/integration | import pytest
from custom_components.hacs.base import HacsConfiguration
from custom_components.hacs.exceptions import HacsException
def test_configuration_and_option():
config = HacsConfiguration()
config.update_from_dict({"token": "xxxxxxxxxx"})
assert isinstance(config.to_json(), dict)
assert isin... | "HACS" | assert | string_literal | tests/hacsbase/test_configuration.py | test_configuration_and_option | 19 | null | |
hacs/integration | from . import patch_time # isort:skip
import asyncio
from collections.abc import Generator
from dataclasses import asdict
from glob import iglob
import json
import logging
import os
import shutil
from typing import Any
from unittest.mock import MagicMock, _patch, patch
from aiohttp import AsyncResolver
from awesomev... | filename) | assert_* | variable | tests/conftest.py | assert_hacs_data | 296 | null | |
hacs/integration | from custom_components.hacs.utils.workarounds import DOMAIN_OVERRIDES
def test_domain_ovverides() -> None:
assert DOMAIN_OVERRIDES.get("custom-components/sensor.custom_aftership") == "custom_aftership"
assert DOMAIN_OVERRIDES.get("awesome/repo") is | None | assert | none_literal | tests/utils/test_workarounds.py | test_domain_ovverides | 6 | null | |
hacs/integration | from collections.abc import Generator
import os
from pathlib import Path
from homeassistant.core import HomeAssistant
import pytest
from custom_components.hacs.repositories.plugin import HacsPluginRepository
from tests.common import (
CategoryTestData,
WSClient,
category_test_data_parametrized,
get_h... | None | assert | none_literal | tests/repositories/test_remove_repository.py | test_remove_repository | 30 | null | |
hacs/integration | from __future__ import annotations
from collections.abc import Iterable
from contextlib import contextmanager
from contextvars import ContextVar
from inspect import currentframe
import json as json_func
import os
from types import NoneType
from typing import Any, TypedDict
from unittest.mock import AsyncMock, patch
f... | "auth_ok" | assert | string_literal | tests/common.py | _create_client | WSClient | 372 | null |
hacs/integration | import asyncio
from collections.abc import Generator
from unittest.mock import patch
from aiogithubapi import GitHubException
from freezegun.api import FrozenDateTimeFactory
from homeassistant import config_entries
from homeassistant.const import CONF_ACCESS_TOKEN
from homeassistant.core import HomeAssistant
from home... | FlowResultType.ABORT | assert | complex_expr | tests/test_config_flow.py | test_flow_with_registration_failure | 220 | null | |
hacs/integration | from aiogithubapi.objects.repository.content import AIOGitHubAPIRepositoryTreeContent
from custom_components.hacs.utils import filters
def test_not_valid():
tree = [
AIOGitHubAPIRepositoryTreeContent(
{"path": ".github/path/file.file", "type": "tree"}, "test/test", "main",
),
]
... | None | assert | none_literal | tests/helpers/filters/test_get_first_directory_in_directory.py | test_not_valid | 27 | null | |
hacs/integration | import asyncio
from collections.abc import Generator
from typing import Any
from homeassistant.core import HomeAssistant
from homeassistant.setup import async_setup_component
import pytest
from custom_components.hacs.base import HacsBase
from tests.common import MockedResponse, ResponseMocker, safe_json_dumps
from t... | "system_health/system_health_after_unload.json") | assert_* | string_literal | tests/test_system_health.py | test_system_health_after_unload | 78 | null | |
hacs/integration | import asyncio
from collections.abc import Generator
from unittest.mock import patch
from aiogithubapi import GitHubException
from freezegun.api import FrozenDateTimeFactory
from homeassistant import config_entries
from homeassistant.const import CONF_ACCESS_TOKEN
from homeassistant.core import HomeAssistant
from home... | "device" | assert | string_literal | tests/test_config_flow.py | test_full_user_flow_implementation | 104 | null | |
hacs/integration | import pytest
from custom_components.hacs.base import HacsRepositories
from custom_components.hacs.enums import HacsCategory
async def test_hacs(hacs, repository, tmpdir):
hacs.hass.config.config_dir = tmpdir
hacs.repositories = HacsRepositories()
assert hacs.repositories.get_by_id(None) is None
rep... | "1337" | assert | string_literal | tests/hacsbase/test_hacs.py | test_hacs | 26 | null | |
hacs/integration | from contextlib import nullcontext as does_not_raise
import re
from awesomeversion import AwesomeVersion
import pytest
from voluptuous.error import Invalid, MultipleInvalid
from custom_components.hacs.utils.validate import (
HACS_MANIFEST_JSON_SCHEMA as hacs_json_schema,
INTEGRATION_MANIFEST_JSON_SCHEMA as in... | Invalid, match=re.escape("Value 'False' is not a string or list.")) | pytest.raises | func_call | tests/utils/test_validate.py | test_hacs_manifest_json_schema | 88 | null | |
hacs/integration | from collections.abc import Generator
from homeassistant.core import HomeAssistant
import pytest
from custom_components.hacs.repositories.plugin import HacsPluginRepository
from tests.common import get_hacs
async def downloaded_plugin_repository(
hass: HomeAssistant,
setup_integration: Generator,
) -> HacsP... | None | assert | none_literal | tests/repositories/test_plugin_repository.py | test_get_resource_handler | 88 | null | |
hacs/integration | from collections.abc import Generator
import json as json_func
import os
from freezegun.api import FrozenDateTimeFactory
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_registry import async_get as async_get_entity_registry
import pytest
from custom_components.hacs.const import DOMAIN
... | None | assert | none_literal | tests/test_update.py | test_update_entity_state | 38 | null | |
hacs/integration | import sys
from unittest.mock import MagicMock, patch
from homeassistant.components.websocket_api import DOMAIN as WEBSOCKET_DOMAIN
from homeassistant.core import HomeAssistant
import pytest
from custom_components.hacs.base import HacsBase
from tests.common import create_config_entry, get_hacs
from tests.conftest im... | { "websocket_commands": [ command for command in hass.data[WEBSOCKET_DOMAIN] if command.startswith("hacs/") ], }) | assert_* | collection | tests/integration/test_integration_setup.py | test_integration_setup | 28 | null | |
hacs/integration | from contextlib import nullcontext as does_not_raise
import re
from awesomeversion import AwesomeVersion
import pytest
from voluptuous.error import Invalid, MultipleInvalid
from custom_components.hacs.utils.validate import (
HACS_MANIFEST_JSON_SCHEMA as hacs_json_schema,
INTEGRATION_MANIFEST_JSON_SCHEMA as in... | 3 | assert | numeric_literal | tests/utils/test_validate.py | test_repo_data_json_schema_multiple_bad_data | 656 | null | |
hacs/integration | from __future__ import annotations
from collections.abc import Iterable
from contextlib import contextmanager
from contextvars import ContextVar
from inspect import currentframe
import json as json_func
import os
from types import NoneType
from typing import Any, TypedDict
from unittest.mock import AsyncMock, patch
f... | "auth_required" | assert | string_literal | tests/common.py | _create_client | WSClient | 368 | null |
hacs/integration | from unittest.mock import AsyncMock, patch
from homeassistant.core import HomeAssistant
import pytest
from custom_components.hacs.const import VERSION_STORAGE
from custom_components.hacs.exceptions import HacsException
from custom_components.hacs.utils.store import (
async_load_from_store,
async_remove_store,... | None | assert | none_literal | tests/utils/test_store.py | test_store_load | 29 | null | |
hacs/integration | import sys
from unittest.mock import MagicMock, patch
from homeassistant.components.websocket_api import DOMAIN as WEBSOCKET_DOMAIN
from homeassistant.core import HomeAssistant
import pytest
from custom_components.hacs.base import HacsBase
from tests.common import create_config_entry, get_hacs
from tests.conftest im... | "constrains" | assert | string_literal | tests/integration/test_integration_setup.py | test_integration_setup_with_custom_updater | 59 | null | |
hacs/integration | import asyncio
import json
import os
from typing import Any
from homeassistant.core import HomeAssistant
import pytest
from scripts.data.generate_category_data import OUTPUT_DIR, generate_category_data
from tests.common import (
FIXTURES_PATH,
CategoryTestData,
MockedResponse,
ResponseMocker,
cat... | f"scripts/data/generate_category_data/single/{category_test_data['category']}/{ category_test_data['repository']}/data.json") | assert_* | string_literal | tests/scripts/data/test_generate_category_data.py | test_generate_category_data_single_repository | 66 | null | |
hacs/integration | from unittest.mock import patch
import pytest
from custom_components.hacs.base import HacsBase
from custom_components.hacs.repositories.base import HacsRepository
from tests.common import ResponseMocker, client_session_proxy
@pytest.mark.parametrize("version,expected", [
("1.0.0", {"name": "Integration basic 1.... | expected["name"] | assert | complex_expr | tests/repositories/test_get_hacs_json_raw.py | test_get_hacs_json_raw | 28 | null | |
hacs/integration | from collections.abc import Generator
import os
from pathlib import Path
from homeassistant.core import HomeAssistant
import pytest
from custom_components.hacs.repositories.plugin import HacsPluginRepository
from tests.common import (
CategoryTestData,
WSClient,
category_test_data_parametrized,
get_h... | 2 | assert | numeric_literal | tests/repositories/test_remove_repository.py | test_remove_repository | 34 | null | |
hacs/integration | from collections.abc import Generator
from homeassistant.core import HomeAssistant
import pytest
from tests.common import (
CategoryTestData,
MockedResponse,
ResponseMocker,
WSClient,
category_test_data_parametrized,
get_hacs,
safe_json_dumps,
)
from tests.conftest import SnapshotFixture
... | None | assert | none_literal | tests/repositories/test_get_reposiotry_releases.py | test_get_reposiotry_releases | 30 | null | |
hacs/integration | from awesomeversion import AwesomeVersion
from custom_components.hacs.base import HacsBase
def test_display_status(hacs: HacsBase):
repository = hacs.repositories.get_by_full_name(
"hacs-test-org/integration-basic")
assert repository.display_status == "default"
repository.data.new = True
ass... | "installed" | assert | string_literal | tests/repositories/test_display_status.py | test_display_status | 33 | null | |
hacs/integration | from contextlib import nullcontext as does_not_raise
import re
from awesomeversion import AwesomeVersion
import pytest
from voluptuous.error import Invalid, MultipleInvalid
from custom_components.hacs.utils.validate import (
HACS_MANIFEST_JSON_SCHEMA as hacs_json_schema,
INTEGRATION_MANIFEST_JSON_SCHEMA as in... | MultipleInvalid) | pytest.raises | variable | tests/utils/test_validate.py | test_repo_data_json_schema_multiple_bad_data | 653 | null | |
hacs/integration | import asyncio
from contextlib import nullcontext as does_not_raise
from typing import ContextManager
from homeassistant.core import HomeAssistant
import pytest
from custom_components.hacs.base import HacsBase
from custom_components.hacs.exceptions import HacsException, HacsNotModifiedException
from tests.common imp... | f"data_client/base/data_validate/{category}.json") | assert_* | string_literal | tests/test_data_client.py | test_basic_functionality_data_validate | 188 | null | |
hacs/integration | from collections.abc import Generator
from homeassistant.core import HomeAssistant
import pytest
from tests.common import (
CategoryTestData,
WSClient,
category_test_data_parametrized,
get_hacs,
)
from tests.conftest import SnapshotFixture
@pytest.mark.parametrize("category_test_data", category_test_... | None | assert | none_literal | tests/repositories/test_download_repository.py | test_download_repository | 26 | null | |
hacs/integration | import pytest
from custom_components.hacs.base import HacsConfiguration
from custom_components.hacs.exceptions import HacsException
def test_configuration_and_option():
config = HacsConfiguration()
config.update_from_dict({"token": "xxxxxxxxxx"})
assert isinstance(config.to_json(), dict)
assert isin... | "ALL" | assert | string_literal | tests/hacsbase/test_configuration.py | test_configuration_and_option | 34 | null | |
hacs/integration | from collections.abc import Generator
import json
import re
from unittest.mock import patch
from homeassistant.core import HomeAssistant, HomeAssistantError
from homeassistant.helpers.entity_registry import async_get as async_get_entity_registry
import pytest
from custom_components.hacs.const import DOMAIN
from test... | HomeAssistantError, match=re.escape( "Version 2.0.0 of hacs-test-org/integration-basic is already downloaded", )) | pytest.raises | func_call | tests/repositories/test_update_repository.py | test_update_repository_entity_same_provided_version | 291 | null | |
hacs/integration | from __future__ import annotations
import json
from typing import Any
import pytest
from slugify import slugify
from custom_components.hacs.base import HacsBase
from custom_components.hacs.repositories.base import HacsRepository
from tests.common import ResponseMocker, client_session_proxy
from tests.conftest impor... | f"{repository.data.full_name}/get_documentation/{slugify(json.dumps(data), separator="_")}.md") | assert_* | string_literal | tests/repositories/test_get_documentation.py | test_repository_get_documentation | 40 | null | |
hacs/integration | from contextlib import nullcontext as does_not_raise
import re
from awesomeversion import AwesomeVersion
import pytest
from voluptuous.error import Invalid, MultipleInvalid
from custom_components.hacs.utils.validate import (
HACS_MANIFEST_JSON_SCHEMA as hacs_json_schema,
INTEGRATION_MANIFEST_JSON_SCHEMA as in... | { "name": "My awesome thing", "country": ["NO"], } | assert | collection | tests/utils/test_validate.py | test_hacs_manifest_json_schema | 33 | null | |
hacs/integration | from unittest.mock import AsyncMock, patch
from homeassistant.core import HomeAssistant
import pytest
from custom_components.hacs.const import VERSION_STORAGE
from custom_components.hacs.exceptions import HacsException
from custom_components.hacs.utils.store import (
async_load_from_store,
async_remove_store,... | HacsException) | pytest.raises | variable | tests/utils/test_store.py | test_store_load | 31 | null | |
hacs/integration | from unittest.mock import patch
import pytest
from custom_components.hacs.base import HacsBase
from custom_components.hacs.repositories.base import HacsRepository
from tests.common import ResponseMocker, client_session_proxy
@pytest.mark.parametrize("version,name", [("1.0.0", "Integration basic 1.0.0"), ("99.99.99"... | None | assert | none_literal | tests/repositories/test_get_hacs_json.py | test_validate_repository | 27 | null | |
hacs/integration | from unittest.mock import patch
import pytest
from custom_components.hacs.base import HacsBase
from custom_components.hacs.repositories.integration import HacsIntegrationRepository
from custom_components.hacs.validate.manager import ValidationManager
async def test_async_run_repository_checks(
hacs: HacsBase,
... | SystemExit) | pytest.raises | variable | tests/validate/test_async_run_repository_checks.py | test_async_run_repository_checks | 21 | null | |
hacs/integration | from collections.abc import Generator
import json
import re
from unittest.mock import patch
from homeassistant.core import HomeAssistant, HomeAssistantError
from homeassistant.helpers.entity_registry import async_get as async_get_entity_registry
import pytest
from custom_components.hacs.const import DOMAIN
from test... | category_test_data["version_update"] | assert | complex_expr | tests/repositories/test_update_repository.py | test_update_repository_entity | 56 | null | |
hacs/integration | import asyncio
from contextlib import nullcontext as does_not_raise
from typing import ContextManager
from homeassistant.core import HomeAssistant
import pytest
from custom_components.hacs.base import HacsBase
from custom_components.hacs.exceptions import HacsException, HacsNotModifiedException
from tests.common imp... | f"data_client/base/repositories/{category_test_data['category']}.json") | assert_* | string_literal | tests/test_data_client.py | test_basic_functionality_repositories | 50 | null | |
hacs/integration | from collections.abc import Generator
import os
from pathlib import Path
from homeassistant.core import HomeAssistant
import pytest
from custom_components.hacs.repositories.plugin import HacsPluginRepository
from tests.common import (
CategoryTestData,
WSClient,
category_test_data_parametrized,
get_h... | 1 | assert | numeric_literal | tests/repositories/test_remove_repository.py | test_remove_repository | 69 | null | |
alexzhang13/rlm | from unittest.mock import Mock
from rlm.core.types import CodeBlock, REPLResult, RLMIteration
from rlm.environments.local_repl import LocalREPL
from rlm.utils.parsing import (
convert_context_for_repl,
find_code_blocks,
find_final_answer,
format_execution_result,
format_iteration,
)
class TestFind... | "42" | assert | string_literal | tests/test_parsing.py | test_final_answer | TestFindFinalAnswer | 87 | null |
alexzhang13/rlm | from unittest.mock import MagicMock
from rlm.core.types import RLMChatCompletion, UsageSummary
from rlm.environments.local_repl import LocalREPL
def _make_completion(response: str) -> RLMChatCompletion:
"""Create a minimal RLMChatCompletion for testing."""
return RLMChatCompletion(
root_model="test-mo... | "gpt-4") | assert_* | string_literal | tests/test_rlm_query.py | test_rlm_query_with_model_override | TestRlmQueryWithSubcallFn | 39 | null |
alexzhang13/rlm | from rlm.core.types import (
CodeBlock,
ModelUsageSummary,
QueryMetadata,
REPLResult,
RLMChatCompletion,
RLMIteration,
RLMMetadata,
UsageSummary,
_serialize_value,
)
class TestREPLResult:
def test_str_representation(self):
result = REPLResult(stdout="test", stderr="", l... | s | assert | variable | tests/test_types.py | test_str_representation | TestREPLResult | 112 | null |
alexzhang13/rlm | from unittest.mock import Mock
from rlm.core.types import CodeBlock, REPLResult, RLMIteration
from rlm.environments.local_repl import LocalREPL
from rlm.utils.parsing import (
convert_context_for_repl,
find_code_blocks,
find_final_answer,
format_execution_result,
format_iteration,
)
class TestFind... | None | assert | none_literal | tests/test_parsing.py | test_final_var_without_environment | TestFindFinalAnswer | 105 | null |
alexzhang13/rlm | import os
from unittest.mock import MagicMock, patch
import pytest
from dotenv import load_dotenv
from rlm.clients.gemini import GeminiClient
from rlm.core.types import ModelUsageSummary, UsageSummary
load_dotenv()
class TestGeminiClientUnit:
def test_get_last_usage(self):
"""Test last usage returns co... | 50 | assert | numeric_literal | tests/clients/test_gemini.py | test_get_last_usage | TestGeminiClientUnit | 65 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.