improve wording in documentation

This commit is contained in:
2022-12-02 15:45:01 +02:00
parent a4f646eb2a
commit 90be3276dd
51 changed files with 73 additions and 70 deletions

View File

@ -35,6 +35,7 @@ def anyvar(cls: Type[T], strict: bool = False) -> T:
any value helper for mocker calls check
Args:
cls(Type[T]): type of the variable to check
strict(bool, optional): if True then check type of supplied argument (Default value = False)
Returns:

View File

@ -10,7 +10,7 @@ def test_auth_control(auth: Auth) -> None:
must return a control for authorization
"""
assert auth.auth_control
assert "button" in auth.auth_control # I think it should be button
assert "button" in auth.auth_control # I think it should be a button
def test_load_dummy(configuration: Configuration, database: SQLite) -> None:

View File

@ -16,10 +16,10 @@ def test_extend_architectures(mocker: MockerFixture) -> None:
must update available architecture list
"""
mocker.patch("pathlib.Path.is_file", return_value=True)
archs_mock = mocker.patch("ahriman.models.package.Package.supported_architectures", return_value={"x86_64"})
architectures_mock = mocker.patch("ahriman.models.package.Package.supported_architectures", return_value={"x86_64"})
assert Sources.extend_architectures(Path("local"), "i686") == [PkgbuildPatch("arch", list({"x86_64", "i686"}))]
archs_mock.assert_called_once_with(Path("local"))
architectures_mock.assert_called_once_with(Path("local"))
def test_extend_architectures_any(mocker: MockerFixture) -> None:
@ -256,7 +256,7 @@ def test_add_intent_to_add(sources: Sources, mocker: MockerFixture) -> None:
def test_add_skip(sources: Sources, mocker: MockerFixture) -> None:
"""
must skip addition of files to index if no fiels found
must skip addition of files to index if no fields found
"""
mocker.patch("pathlib.Path.glob", return_value=[])
check_output_mock = mocker.patch("ahriman.core.build_tools.sources.Sources._check_output")

View File

@ -63,7 +63,7 @@ def test_run(migrations: Migrations, mocker: MockerFixture) -> None:
def test_run_migration_exception(migrations: Migrations, mocker: MockerFixture) -> None:
"""
must rollback and close cursor on exception during migration
must roll back and close cursor on exception during migration
"""
cursor = MagicMock()
mocker.patch("logging.Logger.info", side_effect=Exception())

View File

@ -3,13 +3,13 @@ from ahriman.core.formatters import AurPrinter
def test_properties(aur_package_ahriman_printer: AurPrinter) -> None:
"""
must return non empty properties list
must return non-empty properties list
"""
assert aur_package_ahriman_printer.properties()
def test_title(aur_package_ahriman_printer: AurPrinter) -> None:
"""
must return non empty title
must return non-empty title
"""
assert aur_package_ahriman_printer.title() is not None

View File

@ -3,7 +3,7 @@ from ahriman.core.formatters import ConfigurationPrinter
def test_properties(configuration_printer: ConfigurationPrinter) -> None:
"""
must return non empty properties list
must return non-empty properties list
"""
assert configuration_printer.properties()
@ -17,6 +17,6 @@ def test_properties_required(configuration_printer: ConfigurationPrinter) -> Non
def test_title(configuration_printer: ConfigurationPrinter) -> None:
"""
must return non empty title
must return non-empty title
"""
assert configuration_printer.title() == "[section]"

View File

@ -3,13 +3,13 @@ from ahriman.core.formatters import PackagePrinter
def test_properties(package_ahriman_printer: PackagePrinter) -> None:
"""
must return non empty properties list
must return non-empty properties list
"""
assert package_ahriman_printer.properties()
def test_title(package_ahriman_printer: PackagePrinter) -> None:
"""
must return non empty title
must return non-empty title
"""
assert package_ahriman_printer.title() is not None

View File

@ -3,7 +3,7 @@ from ahriman.core.formatters import PatchPrinter
def test_properties(patch_printer: PatchPrinter) -> None:
"""
must return non empty properties list
must return non-empty properties list
"""
assert patch_printer.properties()
@ -17,6 +17,6 @@ def test_properties_required(patch_printer: PatchPrinter) -> None:
def test_title(patch_printer: PatchPrinter) -> None:
"""
must return non empty title
must return non-empty title
"""
assert patch_printer.title() == "ahriman"

View File

@ -10,6 +10,6 @@ def test_properties(status_printer: StatusPrinter) -> None:
def test_title(status_printer: StatusPrinter) -> None:
"""
must return non empty title
must return non-empty title
"""
assert status_printer.title() is not None

View File

@ -10,6 +10,6 @@ def test_properties(string_printer: StringPrinter) -> None:
def test_title(string_printer: StringPrinter) -> None:
"""
must return non empty title
must return non-empty title
"""
assert string_printer.title() is not None

View File

@ -10,6 +10,6 @@ def test_properties(update_printer: UpdatePrinter) -> None:
def test_title(update_printer: UpdatePrinter) -> None:
"""
must return non empty title
must return non-empty title
"""
assert update_printer.title() is not None

View File

@ -3,13 +3,13 @@ from ahriman.core.formatters import UserPrinter
def test_properties(user_printer: UserPrinter) -> None:
"""
must return non empty properties list
must return non-empty properties list
"""
assert user_printer.properties()
def test_title(user_printer: UserPrinter) -> None:
"""
must return non empty title
must return non-empty title
"""
assert user_printer.title() is not None

View File

@ -10,6 +10,6 @@ def test_properties(version_printer: VersionPrinter) -> None:
def test_title(version_printer: VersionPrinter) -> None:
"""
must return non empty title
must return non-empty title
"""
assert version_printer.title() is not None

View File

@ -20,7 +20,7 @@ def test_load(configuration: Configuration, mocker: MockerFixture) -> None:
def test_load_fallback(configuration: Configuration, mocker: MockerFixture) -> None:
"""
must fallback to stderr without errors
must fall back to stderr without errors
"""
mocker.patch("ahriman.core.log.log.fileConfig", side_effect=PermissionError())
Log.load(configuration, quiet=False, report=False)

View File

@ -5,6 +5,7 @@ from pytest_mock import MockerFixture
from ahriman.core.configuration import Configuration
from ahriman.core.report.html import HTML
from ahriman.models.package import Package
from ahriman.models.result import Result
def test_generate(configuration: Configuration, package_ahriman: Package, mocker: MockerFixture) -> None:
@ -14,5 +15,5 @@ def test_generate(configuration: Configuration, package_ahriman: Package, mocker
write_mock = mocker.patch("pathlib.Path.write_text")
report = HTML("x86_64", configuration, "html")
report.generate([package_ahriman], [])
report.generate([package_ahriman], Result())
write_mock.assert_called_once_with(pytest.helpers.anyvar(int))

View File

@ -17,7 +17,7 @@ def test_leaf_is_root_empty(leaf_ahriman: Leaf) -> None:
def test_leaf_is_root_false(leaf_ahriman: Leaf, leaf_python_schedule: Leaf) -> None:
"""
must be root for empty dependencies list or if does not depend on packages
must be root for empty dependencies list or if it does not depend on packages
"""
assert leaf_ahriman.is_root([leaf_python_schedule])
leaf_ahriman.dependencies = {"ahriman-dependency"}

View File

@ -13,7 +13,7 @@ def test_on_result(trigger: Trigger) -> None:
def test_on_result_run(trigger: Trigger) -> None:
"""
must fallback to run method if it exists
must fall back to run method if it exists
"""
run_mock = MagicMock()
setattr(trigger, "run", run_mock)

View File

@ -59,7 +59,7 @@ def test_asset_upload_with_removal(github: Github, github_release: Dict[str, Any
def test_asset_upload_empty_mimetype(github: Github, github_release: Dict[str, Any], mocker: MockerFixture) -> None:
"""
must upload asset to the repository with empty mime type if cannot guess it
must upload asset to the repository with empty mime type if the library cannot guess it
"""
mocker.patch("pathlib.Path.open", return_value=b"")
mocker.patch("ahriman.core.upload.github.Github.asset_remove")

View File

@ -22,8 +22,8 @@ def _get_owner(root: Path, same: bool) -> Callable[[Path], Tuple[int, int]]:
Callable[[Path], Tuple[int, int]]: function which can define ownership
"""
root_owner = (42, 42)
nonroot_owner = (42, 42) if same else (1, 1)
return lambda path: root_owner if path == root else nonroot_owner
non_root_owner = (42, 42) if same else (1, 1)
return lambda path: root_owner if path == root else non_root_owner
def test_root_owner(repository_paths: RepositoryPaths, mocker: MockerFixture) -> None:

View File

@ -177,7 +177,7 @@ async def test_auth_handler_write(mocker: MockerFixture) -> None:
def test_setup_auth(application_with_auth: web.Application, auth: Auth, mocker: MockerFixture) -> None:
"""
must setup authorization
must set up authorization
"""
setup_mock = mocker.patch("aiohttp_security.setup")
application = setup_auth(application_with_auth, auth)

View File

@ -6,7 +6,7 @@ from ahriman.web.routes import setup_routes
def test_setup_routes(application: web.Application, configuration: Configuration) -> None:
"""
must generate non empty list of routes
must generate non-empty list of routes
"""
setup_routes(application, configuration.getpath("web", "static_path"))
assert application.router.routes()

View File

@ -62,7 +62,7 @@ async def test_get(client: TestClient, package_ahriman: Package) -> None:
assert logs["logs"] == "[1970-01-01 00:00:42] message"
async def test_get_not_foud(client: TestClient, package_ahriman: Package) -> None:
async def test_get_not_found(client: TestClient, package_ahriman: Package) -> None:
"""
must return not found for missing package
"""

View File

@ -51,7 +51,7 @@ async def test_get_redirect_to_oauth_empty_code(client_with_oauth_auth: TestClie
async def test_get(client_with_oauth_auth: TestClient, mocker: MockerFixture) -> None:
"""
must login user correctly from OAuth
must log in user correctly from OAuth
"""
oauth = client_with_oauth_auth.app["validator"]
oauth.get_oauth_username.return_value = "user"
@ -86,7 +86,7 @@ async def test_get_unauthorized(client_with_oauth_auth: TestClient, mocker: Mock
async def test_post(client_with_auth: TestClient, user: User, mocker: MockerFixture) -> None:
"""
must login user correctly
must log in user correctly
"""
payload = {"username": user.username, "password": user.password}
remember_mock = mocker.patch("aiohttp_security.remember")

View File

@ -19,7 +19,7 @@ async def test_get_permission() -> None:
async def test_post(client_with_auth: TestClient, mocker: MockerFixture) -> None:
"""
must logout user correctly
must log out user correctly
"""
mocker.patch("aiohttp_security.check_authorized")
forget_mock = mocker.patch("aiohttp_security.forget")