callee
callee copied to clipboard
Argument matchers for unittest.mock
Hi @Xion or other people who maintains this project, What is the status of this project? This is a great tool for testing, I would like to keep using but...
Docs give the example: # dict with string keys (no restriction on values) Dict(keys=String()) But this will fail because the code expects both keys and value to be defined. Also...
Following tests emit deprecation warning regarding this as below : ``` tests/test_objects.py 80: @asyncio.coroutine 103: @asyncio.coroutine tests/test_functions.py 176: @asyncio.coroutine 199: @asyncio.coroutine ``` ``` tests/test_functions.py::CoroutineFunction::test_coroutine__decorator /root/checked_repos/callee/tests/test_functions.py:177: DeprecationWarning: "@coroutine" decorator is deprecated...
Deprecation warning due to invalid escape sequences. Using raw strings or escaping them again helps in resolving this. Check https://github.com/asottile/pyupgrade/ for automatic fix of this. ``` find . -iname '*.py'...
``` tests/test_collections.py 176:class CustomDict(collections.MutableMapping): 181: if isinstance(iterable, collections.Mapping): ```
Currently the following will fail ``` from callee.general import Captor from mock import Mock mock = Mock() mock(1) captor = Captor() mock.assert_called_with(captor) assert 1 == captor.value # This is ok!...
```python mock_foo.assert_called_with(ARG % 2 == 0) mock_foo.assert_called_with(ARG.id == 42) mock_foo.assert_called_with(ARG('foo') == 'FOO') # etc. ``` as an equivalent of: ```python mock_foo.assert_called_with(ArgThat(lambda x: x % 2 == 0)) mock_foo.assert_called_with(ArgThat(lambda x: x.id...
Example: ```python mock_foo.assert_called_with(Eq(expected, on=attrgetter('id'))) ``` which is equivalent to: ```python mock_foo.assert_called_with(ArgThat(lambda x: x.id == expected.id)) ``` Optionally, if just a string is given to `on=`, treat it as an implicit...
`String` and `Unicode` matchers could accept optional argument for matching characters, e.g. letters, digits, or arbitrary predicates. It could take a set of characters, a callable, or a `Matcher`.