[Pyunit-interest] Unit testing constructors
Brought to you by:
purcell
From: Sean A. <ze...@wo...> - 2002-01-30 00:00:55
|
Hello, sorry if this has been covered before Currently, I am trying to implement a test suite for some objects. The objects need to do bounds checking based on arguments to their __init__() ctor. If the object is given initialization parameters that are out of bounds, an Exception must be thrown. So far, So good. I am having a great deal of difficulty trying to get a test case to work that does something like (pseudo code) ... self.assertRaise(Exception, (attempt to create the object), (args)) ... which basically tells me I have to supply an instance of the object I'm trying to create as first argument, which is not really possible under these conditions. The code works well in interactive testing, it's just how to write the unit test Any ideas? =20 Sean Allen |