[TIP] testing designing with "hidden" attributes

Alceu R. de Freitas Jr. glasswalk3r at yahoo.com.br
Mon Jul 16 09:46:41 PDT 2018


Hello folks,
My name is Alceu and I'm new to this list.
I have already some experience with software testing, but I'm not being able to decide (or find) what is the best way (or pythonic way) to handle a class with hidden attributes.
I have a class that has some hidden attributes and I'm sure that's the way they should be: exposing them is not only unnecessary, but could cause more trouble than helping the developer.
On the other hand, for the class maintainer point of view, unit testing the class instance status after some "public" methods are invoked seems to be quite reasonable.
What is your recommendation about that? Currently I'm declaring those attributes as "__attrib_name", which "hiddens" the attributes, but maybe I should be using properties instead?
Last, but not least, I'm implementing those tests using pytest. Please let me know if there is anything from it that could help me too.
Thanks in advance,
Alceu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20180716/af256a54/attachment.html>


More information about the testing-in-python mailing list