{"id":13501934,"url":"https://github.com/Xion/callee","last_synced_at":"2025-03-29T10:32:27.197Z","repository":{"id":62560705,"uuid":"41265661","full_name":"Xion/callee","owner":"Xion","description":"Argument matchers for unittest.mock","archived":false,"fork":false,"pushed_at":"2020-09-11T14:03:30.000Z","size":221,"stargazers_count":88,"open_issues_count":13,"forks_count":10,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-24T06:53:23.774Z","etag":null,"topics":["matchers","mocking","python","testing","unit-testing"],"latest_commit_sha":null,"homepage":"http://callee.readthedocs.org","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Xion.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-08-23T20:19:45.000Z","updated_at":"2024-07-29T21:38:04.000Z","dependencies_parsed_at":"2022-11-03T14:45:35.108Z","dependency_job_id":null,"html_url":"https://github.com/Xion/callee","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xion%2Fcallee","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xion%2Fcallee/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xion%2Fcallee/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xion%2Fcallee/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Xion","download_url":"https://codeload.github.com/Xion/callee/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246173962,"owners_count":20735406,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["matchers","mocking","python","testing","unit-testing"],"created_at":"2024-07-31T22:01:55.812Z","updated_at":"2025-03-29T10:32:27.168Z","avatar_url":"https://github.com/Xion.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"callee\n======\n\nArgument matchers for *unittest.mock*\n\n|Version| |Development Status| |Python Versions| |License| |Build Status|\n\n.. |Version| image:: https://img.shields.io/pypi/v/callee.svg?style=flat\n    :target: https://pypi.python.org/pypi/callee\n    :alt: Version\n.. |Development Status| image:: https://img.shields.io/pypi/status/callee.svg?style=flat\n    :target: https://pypi.python.org/pypi/callee/\n    :alt: Development Status\n.. |Python Versions| image:: https://img.shields.io/pypi/pyversions/callee.svg?style=flat\n    :target: https://pypi.python.org/pypi/callee\n    :alt: Python versions\n.. |License| image:: https://img.shields.io/pypi/l/callee.svg?style=flat\n    :target: https://github.com/Xion/callee/blob/master/LICENSE\n    :alt: License\n.. |Build Status| image:: https://img.shields.io/travis/Xion/callee.svg?style=flat\n    :target: https://travis-ci.org/Xion/callee\n    :alt: Build Status\n\n\nMore robust tests\n~~~~~~~~~~~~~~~~~\n\nPython's `mocking library`_ (or its `backport`_ for Python \u003c3.3) is simple, reliable, and easy to use.\nBut it is also a little lacking when it comes to asserting what calls a mock has received.\n\nYou can be either very specific::\n\n    my_mock.assert_called_once_with(42, some_foo_object, 'certain string')\n\nor extremely general::\n\n    my_mock.assert_called_with(ANY, ANY, ANY)\n    # passes as long as argument count is the same\n\n| The former can make your tests over-specified, and thus fragile.\n| The latter could make them too broad, missing some erroneous cases and possibly letting your code fail in production.\n\n----\n\n*callee* provides **argument matchers** that allow you to be exactly as precise as you want::\n\n    my_mock.assert_called_with(GreaterThan(0), InstanceOf(Foo), String())\n\nwithout tedious, handcrafted, and poorly readable code that checks ``call_args`` or ``call_args_list``::\n\n    self.assertGreater(mock.call_args[0][0], 0)\n    self.assertIsInstance(mock.call_args[0][1], Foo)\n    self.assertIsInstance(mock.call_args[0][2], str)\n\nIt has plenty of matcher types to fit all common and uncommon needs, and you can easily write your own if necessary.\n\n.. _mocking library: https://docs.python.org/3/library/unittest.mock.html\n.. _backport: https://pypi.python.org/pypi/mock\n\n\nInstallation\n~~~~~~~~~~~~\n\nInstalling *callee* is easy with pip::\n\n    $ pip install callee\n\n| *callee* support goes all the way back to Python 2.6.\n| It also works both with the ``unittest.mock`` module from Python 3.3+ or its backport.\n\n\nAPI reference\n~~~~~~~~~~~~~\n\nSee the `documentation`_ for complete reference on the library usage and all available matchers.\n\n.. _documentation: http://callee.readthedocs.org\n\n\nContributing\n~~~~~~~~~~~~\n\nContributions are welcome!\nIf you need ideas, head to the issue tracker or search for the various ``TODO``\\ s scattered around the codebase.\nOr just think what matchers you'd like to add :)\n\nAfter cloning the repository, this should get you up and running::\n\n    # ... create virtualenv as necessary ...\n    pip install -r requirements-dev.txt\n    tox\n\nTo regenerate documentation and display it in the browser, simply run::\n\n    inv docs\n\nHappy hacking!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FXion%2Fcallee","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FXion%2Fcallee","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FXion%2Fcallee/lists"}