Code review comment for lp:~robru/gwibber/locked-login-refactor

Revision history for this message
Barry Warsaw (barry) wrote :

On Oct 10, 2012, at 06:40 PM, Robert Bruce Park wrote:

>Except that some unforeseen error condition that prevents the dict from
>being returned is *much* more likely to return None instead of the
>integer 7 or a non-empty list, because None is what you get when you
>call return with no values.

Except there's only one way out of get_json() and that's through json.loads().
So you *could* get None back, but you'd have to have gotten a response of just
the string 'null', since that's the only thing that results in None by
json.loads().

Yes, that's an error condition, but again, it's unlikely and you can't defend
against every possible response from a service.

>So I don't think a simple test against the false-ness of the return value is
>particularly unreasonable, especially when it is only 5 bytes of source code.
>
>> In situations like this, I prefer to react to bugs so that we know exactly
>> what situation can cause the non-true return value to occur. In any event,
>> a test case would be useful.
>
>Ok, but you made the change, so you write the test :-P

But in this case, there's nothing more to test. :)

« Back to merge proposal