On Sunday 17 July 2005 09:58, Lior Kesos wrote: > Another option for mocking would be a class that would inherit from cgi > and then overload the functions you want to manipulate. > meaning : > class mycgi(cgi): > def get_params(self): > doMyOwnMagic() > > Using mycgi will probebly be transparent to any component which is using > cgi...
Yes, but then you'll need to change the code to say "import mycgi" instead of "import cgi". I'm not sure but doing this scheme might create a none-full test coverage. Regards, Shlomi Fish > you just switch the import mycgi instead and you get all of the methods > defined in cgi "for free". > This a is very common practice within python modules where sometimes the > way to use he module is to inherit it an start overloading it's > finctions (HTMLParser for example with it's in_[tag] functions. > > Lior -- --------------------------------------------------------------------- Shlomi Fish [EMAIL PROTECTED] Homepage: http://www.shlomifish.org/ Tcl is LISP on drugs. Using strings instead of S-expressions for closures is Evil with one of those gigantic E's you can find at the beginning of paragraphs.