
Security News
ESLint Adds Official Support for Linting HTML
ESLint now supports HTML linting with 48 new rules, expanding its language plugin system to cover more of the modern web development stack.
This module contains a set of decorators that allow to mock functions. (Replacing the behavior of a method, attribute, object or class)
This module has been created using python 3.4 and tested in python 2.7, 3.4 and 3,5. This should works in python 2.7 and higher. If you want to know if this module works in a concrete python version, download the project and execute:
make test PYTHON_VERSION=<python-version>
where is the version to test. Note: you must be installed that version.
1.0:
1.0.1:
1.0.2-1.0.4
1.0.5
1.0.6
make test-versions
makes tests for python 2 and 31.0.7
1.0.9
1.1.0
1.1.1
This module can be installed using the following options:
pip install mock_decorators
pip install git+https://github.com/fhuertas/mock_decorators (for 1.1.1 version)
The tests contain examples to use this library but here there are the more useful examples:
This mock replace a function for other. Example
The parameters are the following:
This mock replace a function for a result value. Example
The parameters are the following:
This mock modify the result of a function. i.e. if Add 2 to a result of a function. Example
The parameters are the following:
This mock checks if a function is called or not and optionally the times that it is called. By default the function is invoked but instead a value can be returned Example
The parameters are the following:
This mock change the value of a attribute for other. Example
The parameters are the following:
This mock only work in python 3 and higher. This mock replace a class or object by other. Example
The parameters are the following:
This mock replace a value in a map by other value. Example
The parameters are the following:
This mock catch the system output in a Stream. It is desirable that it is a StringIO. Example
The parameters are the following:
FAQs
Mock library using python decorators
We found that mock-decorators demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ESLint now supports HTML linting with 48 new rules, expanding its language plugin system to cover more of the modern web development stack.
Security News
CISA is discontinuing official RSS support for KEV and cybersecurity alerts, shifting updates to email and social media, disrupting automation workflows.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.