yanne / api-test

0 stars 0 forks source link

Strings `false` and `False` evaluate false in `Execute Command` and `Read Command Output` arguments #82

Closed yanne closed 10 years ago

yanne commented 10 years ago

Keywords Execute Command and Read Command Output arguments return_stdout, return_stderr and return_rc should be handled so that non-empty strings evaluate true except for false and False, which should evaluate false. Currently strings false and False are handled as non-empty strings, hence always evaluate true.

This issue was originally opened at Google Code on Sep 9, 2013.

yanne commented 10 years ago

Original comment by anssi.sy...@eficode.com on Sep 9, 2013.

This was done by commit https://code.google.com/p/robotframework-sshlibrary/source/detail?r=507f7480cb1f77ab503878a409bc120859cc5cf6

yanne commented 10 years ago

Original comment by pekka.klarck on Oct 16, 2013.

The revision referenced above only contains tests but I was able to find the implementation that looks like this:

def _output_wanted(self, value):
    return (value and str(value).lower() != 'false')

This looks good to be although the surrounding parenthesis are unnecessary.