New GitHub issue #95078 from galenhwang:<br>
<hr>
<pre>
<!--
If you're new to Python and you're not sure whether what you're experiencing is a bug, the CPython issue tracker is not
the right place to seek help. Consider the following options instead:
- reading the Python tutorial: https://docs.python.org/3/tutorial/
- posting in the "Users" category on discuss.python.org: https://discuss.python.org/c/users/7
- emailing the Python-list mailing list: https://mail.python.org/mailman/listinfo/python-list
- searching our issue tracker (https://github.com/python/cpython/issues) to see if
your problem has already been reported
-->
**Bug report**
Would like to set name attribute of a mocked object directly when creating Mock() object.
Currently, the workaround is to do:
```python
from unittest.mock import Mock
obj = Mock(x=1, y="val")
obj.name = "name"
```
instead of directly assigning the attribute in the constructor.
Has been mentioned in the Stack Overflow community before in https://stackoverflow.com/questions/62552148/how-to-mock-name-attribute-with-unittest-mock-magicmock-or-mock-classes.
A suggestion would be to rename the current `name` attribute to `mock_name`.
</pre>
<hr>
<a href="https://github.com/python/cpython/issues/95078">View on GitHub</a>
<p>Labels: type-bug</p>
<p>Assignee: </p>