From 6826c91dafe07815e43f30aeae19335cfe1952b8 Mon Sep 17 00:00:00 2001 From: cockroacher <163405488+cockroacher@users.noreply.github.com> Date: Wed, 10 Apr 2024 21:26:11 +0200 Subject: [PATCH] pylint docstring --- tests/a11y_statement.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/tests/a11y_statement.py b/tests/a11y_statement.py index 827b48db..587d5cd5 100644 --- a/tests/a11y_statement.py +++ b/tests/a11y_statement.py @@ -14,6 +14,21 @@ canonical = 'https://www.digg.se/tdosanmalan' # pylint: disable=invalid-name def run_test(global_translation, lang_code, url): + """ + Runs a test on a given URL and returns the rating and a dictionary. + + This function uses both global and local translations to print status updates. + It parses the URL, gets the default information, checks the item, + rates the statement, and finally returns the rating and a dictionary. + + Parameters: + global_translation (function): A function that provides global translation. + lang_code (str): The language code to be used for local translation. + url (str): The URL to be tested. + + Returns: + tuple: A tuple containing the rating (an instance of the Rating class) and a dictionary. + """ local_translation = get_translation('a11y_statement', lang_code) print(local_translation('TEXT_RUNNING_TEST')) @@ -166,6 +181,24 @@ def has_statement(item, global_translation, local_translation): def get_default_info(url, text, method, precision, depth): + """ + Constructs a dictionary with default information. + + This function takes in several parameters, + processes the 'text' parameter, and stores all parameters in a dictionary. + + Parameters: + url (str): The URL to be stored in the dictionary. + text (str): The text to be processed and stored in the dictionary. + If provided, + it is converted to lowercase and stripped of leading/trailing periods and hyphens. + method (str): The method to be stored in the dictionary. + precision (int/float): The precision value to be stored in the dictionary. + depth (int): The depth value to be stored in the dictionary. + + Returns: + dict: A dictionary containing the processed parameters. + """ result = {} if text is not None: