Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This behaviour has changed in Python 3.5 [1], and it was also backported to the mock package.

When unsafe=False (the default), accessing an attribute that begins with assert will raise an error.

[1]: https://docs.python.org/3/library/unittest.mock.html#the-moc...



> accessing an attribute that begins with assert

Or any of the names in this surprising hardcoded list of typos https://github.com/python/cpython/blob/fdb9efce6ac211f973088...


do you happen to know if this is true on mock==2.0?


Yes it looks as if that functionality is in 2.0, but the list of typos isn’t as extensive as in later versions.

https://mock.readthedocs.io/en/latest/changelog.html#and-ear...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: