tests.test_extra

Extra Test module for optional functionality.

[!CAUTION] Multicast project testing code is under an MIT license like the Multicast module; however the project’s Testing can use tools which are split between multiple licenses. While all the source-code is open-source, using some of the project test code is only possible in an environment where additional restrictions apply, due to third-party licensing which is incompatible if it were to be included with the rest of the project.

Environment Compatibility: Users must ensure that their testing environments are equipped with the necessary components and licenses to run the testing code. This is akin to a “batteries not included” disclaimer, indicating that additional setup may be required. AS-IS Disclaimer: Please note that the Multicast project is provided “AS-IS,” and we do not guarantee compatibility or support for the testing code outside of the specified environments. Users are responsible for ensuring compliance with all applicable licenses and for setting up their environments accordingly.

This module provides extra test cases for some of the optional components and are expected to fail.

Module Contents

Classes

ExtraDocsUtilsTestSuite

Test cases for docs.utils module.

Functions

onlyIfHasDocs

Conditionally enable a test suite class based on the availability of the multicast docs library.

Data

__module__

_HAS_DOCS

This module optionally provides extra test cases for the docs.utils module, focusing on the utils.sanitize_url method for url encoding.

API

tests.test_extra.__module__[source]

‘tests’

tests.test_extra._HAS_DOCS: bool[source]

False

This module optionally provides extra test cases for the docs.utils module, focusing on the utils.sanitize_url method for url encoding.

    Bundling documentation is not supported by this project, however for users that accept the
    relevant terms and conditions of the optional docs module's dependencies, and have installed it,
    the following optional tests hopefully extend to testing some of the multicast documentation
    code.

    Otherwise this file is effectively omitted from testing.

    Disclaimer:
    For clarity this file (as python sourcecode) is Licensed under MIT (the "License");
    The resulting python tests (as software) are only provided "AS IS" and WITHOUT WARRANTIES OR
    CONDITIONS OF ANY KIND, either express or implied. The dependencies of the resulting
    python tests (as software), are NOT covered by the same Licensed. Assembly may be required.
tests.test_extra.onlyIfHasDocs(has_docs: bool) callable[source][source]

Conditionally enable a test suite class based on the availability of the multicast docs library.

If the provided flag is False, returns a dummy class with a placeholder method that does nothing, allowing tests dependent on docs to be safely bypassed. If the provided flag is True, the original class is returned unchanged.

Arguments: has_docs (bool): Flag indicating whether the docs module is available.

Returns: callable: A decorator function that returns either the original class or a dummy class with a placeholder method, depending on the has_docs flag.

Meta-Testing:

    >>> @onlyIfHasDocs(has_docs=False)
    ... class TestClass: pass
    >>> hasattr(TestClass(), 'method')
    True
class tests.test_extra.ExtraDocsUtilsTestSuite(methodName='runTest')[source][source]

Bases: context.BasicUsageTestSuite

Test cases for docs.utils module.

Initialization

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

__module__[source]

‘tests.test_extra’

URL_TEST_FIXTURES[source]

None

test_sanitize_url_GIVEN_raw_url_IS_reliable() None[source][source]

Test case 1: Test to ensure reliable URL sanitization.