[Lldb-commits] [lldb] r255542 - Make skipIf decorator support not_in() functor.

Zachary Turner via lldb-commits lldb-commits at lists.llvm.org
Mon Dec 14 18:41:17 PST 2015


On Mon, Dec 14, 2015 at 4:10 PM Siva Chandra <sivachandra at google.com> wrote:

> This change looks very innocent, but:
>
> On Mon, Dec 14, 2015 at 1:26 PM, Zachary Turner via lldb-commits
> <lldb-commits at lists.llvm.org> wrote:
> > URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py?rev=255542&r1=255541&r2=255542&view=diff
> >
> ==============================================================================
> > --- lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py (original)
> > +++ lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py Mon Dec 14
> 15:26:49 2015
> > @@ -613,14 +613,16 @@ def expectedFailure(expected_fn, bugnumb
> >  # You can also pass not_in(list) to reverse the sense of the test for
> the arguments that
> >  # are simple lists, namely oslist, compiler, and debug_info.
> >
> > -def not_in (iterable):
> > +def not_in(iterable):
> >      return lambda x : x not in iterable
> >
> > -def check_list_or_lambda (list_or_lambda, value):
> > +def check_list_or_lambda(list_or_lambda, value):
> >      if six.callable(list_or_lambda):
> >          return list_or_lambda(value)
> > -    else:
> > +    elif isinstance(list_or_lambda, list):
>
> Previously, list_or_lambda could be a string. It cannot be now. That
> is, we should have:
>
> elif isinstance(list_or_lambda, list) or isinstance(list_or_lambda, str):
>
Then won't that check `value in list_or_lambda` where `list_or_lambda` is a
string, meaning it would only pass if `value` is a character?  That seems
wrong.


>
> >          return list_or_lambda is None or value is None or value in
> list_or_lambda
> > +    else:
> > +        return list_or_lambda == value
>
> Previously, if value or list_or_lambda were None, this function
> returned True. It returns False now unless both are None. That is, it
> should be:
>
> else:
>     return list_or_lambda is None or value is None or list_or_lambda ==
> value
>
> Will send a change list soon with the above fixed.
>
That definitely seems like a good fix.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20151215/0d21735e/attachment-0001.html>


More information about the lldb-commits mailing list