This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mariocj89
Recipients mariocj89, vstinner
Date 2017-06-01.21:00:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1496350859.9.0.608388494481.issue30541@psf.upfronthosting.co.za>
In-reply-to
Content
Sample implementation using the new class:
https://github.com/mariocj89/cpython/commit/2f13963159e239de041cd68273b9fc4a2aa778cd

Sample implementation using the new function to seal existing mocks:
https://github.com/mariocj89/cpython/commit/9ba039e3996f4bf357d4827123e0b570d84f5bb6

Happy to submit a PR if the idea is accepted.

The only benefit I see from the using a separate class is that you will be able to do:

>>> m = mock.SealedMock()
>>> m.important_attr = 42
>>> m.freeflow_attribute = mock.Mock()
>>> mock.seal(m)

which will allow to define "subparts of the mock" without the sealing.

That said I still prefer the function implementation as it looks much nicer (credit to Victor Stinner for the idea)
History
Date User Action Args
2017-06-01 21:00:59mariocj89setrecipients: + mariocj89, vstinner
2017-06-01 21:00:59mariocj89setmessageid: <1496350859.9.0.608388494481.issue30541@psf.upfronthosting.co.za>
2017-06-01 21:00:59mariocj89linkissue30541 messages
2017-06-01 21:00:59mariocj89create