In article <[EMAIL PROTECTED]>,
 Ben Finney <[EMAIL PROTECTED]> wrote:

> Then what you're really testing is the interactions of the "push the
> button" function with its external interface: you're asserting that
> the "push the red button" function actually uses the result from "pick
> a random city" as its target.

No, that's not what I'm testing at all.  I want to test that the cities 
really do get picked randomly.  Notice the implementation I gave:

   def _pickCity():
      cities = ['New York', 'Moscow', 'Tokyo', 'Beijing', 'Mumbai']
      thePoorSchmucks = random.choice(cities)
      return 'New York'

There's a deliberate bug in there, i.e. it always returns 'New York', which 
(as a resident of that city), I would find distressing in such an 
application.  If you plugged in some other function for _pickCity(), you'd 
never discover that bug until it was too late.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to