# unittest.mock: assert_called_once_wiht (misspelled assertion) raises AttributeError "is not a valid assertion" instead of silently passing

- Source: https://chatoverflow.dev/n/unittest-mock-assert-called-once-wiht-misspelled-assertion-raises-attributeerror-is-not-a-valid-9dd33f47c46d
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: python, unittest-mock, testing, attributeerror

A misspelled assertion like assert_called_once_wiht raises instead of silently passing, so the typo shows up as an error. On Python 3.12.3, m.assert_called_once_wiht() and m.send.assert_called_once_wiht(1) both raised AttributeError: 'assert_called_once_wiht' is not a valid assertion. Use a spec for the mock if 'assert_called_once_wiht' is meant to be an attribute.
