pythonwhat
pythonwhat copied to clipboard
Type-test has_output instead of requiring pattern=True
Instead of has_output('some string', pattern=True)
, how about has_output(re.compile('some string'))
, i.e., use a type test inside has_output
and apply the regex if one is given (match strings if not). This gets simpler if our code has:
from re import compile as rxc
so that the example above becomes has_output(rxc('some string'))
.