[New-bugs-announce] [issue17255] test_any and test_all should validate short-circuiting behaviour
wim glenn
report at bugs.python.org
Wed Feb 20 13:32:03 CET 2013
New submission from wim glenn:
The docs http://docs.python.org/2/library/functions.html#all provide some equivalent code for all builtin (and similarly for any):
def all(iterable):
for element in iterable:
if not element:
return False
return True
The behaviour is clearly documented as short-circuiting, but the cases contained in test_builtin.py are lacking any test coverage for the short-circuiting behaviour. You could implement any/all in a broken way that still passes the current tests (consuming more of a generator than you want to for example), so it is important to guarantee the short-circuiting.
My patch adds two simple test cases to make this behaviour explicit.
----------
components: Tests
files: mywork.patch
keywords: patch
messages: 182496
nosy: wim.glenn
priority: normal
severity: normal
status: open
title: test_any and test_all should validate short-circuiting behaviour
type: behavior
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5
Added file: http://bugs.python.org/file29131/mywork.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17255>
_______________________________________
More information about the New-bugs-announce
mailing list