On 02/03/2015 18:03, Dave Angel wrote:
On 03/02/2015 11:25 AM, Sydney Shall wrote:
I am a beginner and I am now at the strage of learning to write
unittests.
I have followed the current discussion entitled "How to test a class in
pyhton", and I am not clear precisely what is meant by state. In its
common meaning I can see some relevance. But is there a technical aspect
to the notion. I see it mentioned often and feel rather uncomfortable
that I know so little about it.
I have deliberately started a new thread.
Thanks.

When I started composing this, there were no other replies.  Sorry for
any duplication caused by that.

Starting with a dictionary definition:

http://www.merriam-webster.com/dictionary/state
"the overall physical condition of something : the ability of something
to be used, enjoyed, etc."

Others:


"The particular condition that someone or something is in at a specific
time"

"In computer science and automata theory, the state of a digital logic
circuit or computer program is a technical term for all the stored
information, at a given instant in time, to which the circuit or program
has access."

That last comes the closest to what I'd like to explain.

For a given fragment of executing code, the state includes all local
variables, all parameters, all closures, all visible globals (ie the
ones that *could* be visible to the code.  It also includes indirectly
the values of all environment variables, lots of system information like
the current directory, the time, the network IP address.  It also
includes the current phase of the moon, the astrological sign of the
current president of France, and the number of specs of sand on the
eastern shore of a certain Martian lake.
Thank you very much, Joel, Danny, Alan and Dave.
Your explanations are all very clear and very enlightening.
I shall have to change several of my unittests now. In good time.
I am particularly pleased with the examples; they clarify matters considerably for me.

Out of subject, I wonder from this exchange whether teaching should not always involve at least several teachers. Your replies are very complimentary!


--
Sydney
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to