You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Greg Stein <gs...@lyra.org> on 2002/10/14 10:50:40 UTC

Re: svn commit: rev 3363 - trunk/subversion/tests/clients/cmdline/svntest

On Mon, Oct 14, 2002 at 02:41:34AM -0500, brane@tigris.org wrote:
>...
> +++ trunk/subversion/tests/clients/cmdline/svntest/testcase.py	Mon Oct 14 02:41:33 2002
> @@ -30,9 +30,11 @@
>  
>    def __init__(self, func):
>      if isinstance(func, _Predicate):
> -      self.func = func.func
> -      self.cond = func.cond
> -      self.text = func.text
> +      # Whee, this is better than blessing objects in Perl!
> +      # For the unenlightened: What we're doing here is adopting the
> +      # identity *and class* of 'func'
> +      self.__dict__ = func.__dict__
> +      self.__class__ = func.__class__

Euh... are you sure that is doable in Python 2.0? So far, we've said the
test suite only requires 2.0. I've a sneaky feeling the above code may
require 2.1 or 2.2.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: svn commit: rev 3363 - trunk/subversion/tests/clients/cmdline/svntest

Posted by br...@xbc.nu.
Quoting Greg Stein <gs...@lyra.org>:

> On Mon, Oct 14, 2002 at 02:41:34AM -0500, brane@tigris.org wrote:
> >...
> > +++ trunk/subversion/tests/clients/cmdline/svntest/testcase.py	Mon Oct
> 14 02:41:33 2002
> > @@ -30,9 +30,11 @@
> >  
> >    def __init__(self, func):
> >      if isinstance(func, _Predicate):
> > -      self.func = func.func
> > -      self.cond = func.cond
> > -      self.text = func.text
> > +      # Whee, this is better than blessing objects in Perl!
> > +      # For the unenlightened: What we're doing here is adopting
> the
> > +      # identity *and class* of 'func'
> > +      self.__dict__ = func.__dict__
> > +      self.__class__ = func.__class__
> 
> Euh... are you sure that is doable in Python 2.0? So far, we've said the
> test suite only requires 2.0. I've a sneaky feeling the above code may
> require 2.1 or 2.2.

I tested this with 2.0, and it works for me. It is quite a terrific hack,
though. It would be nice if there was a module that could do stuff like that.
Maybe the shallow/deep copy thingie would work, but after thinking this up I had
no energy left to try it. :-)

    Brane

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org