Mocking library for Python.
Project description
mimid
Mocking library for Python.
⚠️ This project is under development, current version is just a PoC.
Installation
To install mimid
, simply use pip
:
$ pip install mimid
Quick start
from mimid import mock, every, verify
class Calc:
def add(self, a, b):
return a + b
def test_add():
calc_mock = mock(Calc)
every(calc_mock.add).returns(5)
result = calc_mock.add(2, 2)
assert result == 5
verify(calc_mock.add).with_args(2, 2).called_once()
Why not unittest.mock
?
Python built-in mock
module is an awesome tool. It's a first choice if you want to mock something in you tests.
However it has a few disadvantages:
- it doesn't work well with modern IDEs (e.g. auto completion)
- it doesn't work well with type hinted code
- it's difficult to define different behaviours for different call arguments
- it allows too much freedom
Authors
Created by Konrad Hałas.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
mimid-0.0.4.tar.gz
(2.8 kB
view details)
Built Distribution
mimid-0.0.4-py3-none-any.whl
(3.7 kB
view details)
File details
Details for the file mimid-0.0.4.tar.gz
.
File metadata
- Download URL: mimid-0.0.4.tar.gz
- Upload date:
- Size: 2.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7bb4c1d6923e3b27faccb47956717298a86aa467f55de81bd810716c6427b68a |
|
MD5 | 4146f7dc10ca12b9ad82f422a3e08b0c |
|
BLAKE2b-256 | d291fa74b4e0c7b89069e22cf162c0b23a2a3ba7ecc2b12b587b5e2710d07187 |
File details
Details for the file mimid-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: mimid-0.0.4-py3-none-any.whl
- Upload date:
- Size: 3.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c3b01cb024bf104b512685a11f9c74e12a6b32cdbe654b35541c355e8c59c059 |
|
MD5 | 15a64c35688b4684f1b4e09655c34c45 |
|
BLAKE2b-256 | 49c8a625026c92d2eb0090ad3f943bf3899b31a577e9c53ab508603127273ddb |