[TIP] testing designing with "hidden" attributes
Alceu R. de Freitas Jr.
glasswalk3r at yahoo.com.br
Mon Jul 16 09:46:41 PDT 2018
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,
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the testing-in-python