{"id":15571311,"url":"https://github.com/wimglenn/copyingmock","last_synced_at":"2025-04-09T17:20:58.319Z","repository":{"id":14029626,"uuid":"75693566","full_name":"wimglenn/copyingmock","owner":"wimglenn","description":"A subclass of MagicMock that copies the arguments","archived":false,"fork":false,"pushed_at":"2024-11-05T03:00:10.000Z","size":12,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-23T19:22:22.834Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wimglenn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-12-06T04:10:06.000Z","updated_at":"2024-11-05T03:00:12.000Z","dependencies_parsed_at":"2024-12-20T14:48:09.792Z","dependency_job_id":"6034ce13-f3af-429d-8ee0-b1d215d95a68","html_url":"https://github.com/wimglenn/copyingmock","commit_stats":{"total_commits":8,"total_committers":3,"mean_commits":"2.6666666666666665","dds":0.5,"last_synced_commit":"5ce3de67dbce0d42b502ab2719ce1c285504620e"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wimglenn%2Fcopyingmock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wimglenn%2Fcopyingmock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wimglenn%2Fcopyingmock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wimglenn%2Fcopyingmock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wimglenn","download_url":"https://codeload.github.com/wimglenn/copyingmock/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248074953,"owners_count":21043498,"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":[],"created_at":"2024-10-02T17:58:45.824Z","updated_at":"2025-04-09T17:20:58.301Z","avatar_url":"https://github.com/wimglenn.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![pypi](https://img.shields.io/pypi/v/copyingmock.svg)](https://pypi.org/project/copyingmock/)\n![pyversions](https://img.shields.io/pypi/pyversions/copyingmock.svg)\n[![actions](https://github.com/wimglenn/copyingmock/actions/workflows/ci.yml/badge.svg)](https://github.com/wimglenn/copyingmock/actions)\n[![codecov](https://codecov.io/gh/wimglenn/copyingmock/branch/master/graph/badge.svg)](https://app.codecov.io/gh/wimglenn/copyingmock)\n![womm](https://cdn.rawgit.com/nikku/works-on-my-machine/v0.2.0/badge.svg)\n\n# Copying Mock\n\n`MagicMock` has problems when used on a function with mutable arguments.\nThis is called out in the [documentation](https://docs.python.org/3/library/unittest.mock-examples.html#coping-with-mutable-arguments):\n\n\u003e Another situation is rare, but can bite you, is when your mock is\n\u003e called with mutable arguments. `call_args` and `call_args_list` store\n\u003e references to the arguments. If the arguments are mutated by the code\n\u003e under test then you can no longer make assertions about what the\n\u003e values were when the mock was called.\n\nThey then go on to propose a workaround, using `side_effect`, but it's\nnot very likable. There is also an elegant recipe offered which copies\narguments at call-time. It's simply a subclass of `MagicMock` which\ncopies the arguments, instead of storing references. I'm not sure why\nthe recipe wasn't included directly in `mock`, so here it is as a\nthird-party package.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwimglenn%2Fcopyingmock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwimglenn%2Fcopyingmock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwimglenn%2Fcopyingmock/lists"}