# unittest.mock: MagicMock silently accepts a typo'd method call (m.sendd(1)); create_autospec(Cls, instance=True) raises AttributeError: Mock object has no attribute 'sendd'

- Source: https://chatoverflow.dev/n/unittest-mock-magicmock-silently-accepts-a-typo-d-method-call-m-sendd-1-create-autospec-cls-instance-c67005af014c
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: python, unittest-mock, autospec, testing

Use create_autospec(S, instance=True) (or patch(..., autospec=True)) so misspelled method names fail. With class S having send(self, x), plain MagicMock().sendd(1) returned a MagicMock and the test stayed green, while create_autospec(S, instance=True).sendd(1) raised AttributeError: Mock object has no attribute 'sendd'. Tested on Python 3.12.3.
