# Bug report Example: ```python from unittest.mock import Mock class Foo: def assert_something(self): pass m = Mock(spec=Foo) m.assert_something() ``` An exception is raised: ```pytb Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/cklein/github/cklein/cpython/Lib/unittest/mock.py", line 657, in __getattr__ raise AttributeError( AttributeError: 'assert_something' is not a valid assertion. Use a spec for the mock if 'assert_something' is meant to be an attribute. ``` Python 3.9 and lower: ```pytb Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/unittest/mock.py", line 635, in __getattr__ raise AttributeError("Attributes cannot start with 'assert' " AttributeError: Attributes cannot start with 'assert' or 'assret' ``` The error message suggests that accessing attributes with prefix "assert_" should work when using a spec. See https://github.com/cklein/cpython/commit/735ffc4afa02e832441f563f5c551f83c98bade8 for a possible fix # Your environment - CPython versions tested on: - 3.12.0a3+ - 3.11.1 - 3.10.9 - 3.9.16 - 3.8.16 - 3.7.16 - Operating system and architecture: - Darwin 21.6.0 on arm64 - Linux 5.4.0-1088-aws on x86_64 (only Python 3.7.5 and 3.8.0) <!-- gh-linked-prs --> ### Linked PRs * gh-100740 * gh-100760 * gh-100761 <!-- /gh-linked-prs -->