4 ms·
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 begi
by alasdairnicol 6y ago
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-mock-class https://docs.python.org/3/library/unittest.mock.html#the-moc...
- f00_ 6y agodo you happen to know if this is true on mock==2.0?
- alasdairnicol 6y agoYes 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-earlier https://mock.readthedocs.io/en/latest/changelog.html#and-ear...
- progval 6y ago> 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/fdb9efce6ac211f973088eef508740c3fa2bd182/Lib/unittest/mock.py#L634 https://github.com/python/cpython/blob/fdb9efce6ac211f973088...