Skip to content

Commit

Permalink
python#17255: test short-circuiting behavior of any()/all(). Patch by…
Browse files Browse the repository at this point in the history
… Wim Glenn.
  • Loading branch information
ezio-melotti committed Feb 21, 2013
1 parent c510a04 commit 0f4377c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Lib/test/test_builtin.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ def test_all(self):
self.assertRaises(TypeError, all) # No args
self.assertRaises(TypeError, all, [2, 4, 6], []) # Too many args
self.assertEqual(all([]), True) # Empty iterator
self.assertEqual(all([0, TestFailingBool()]), False)# Short-circuit
S = [50, 60]
self.assertEqual(all(x > 42 for x in S), True)
S = [50, 40, 60]
Expand All @@ -169,6 +170,7 @@ def test_any(self):
self.assertRaises(TypeError, any) # No args
self.assertRaises(TypeError, any, [2, 4, 6], []) # Too many args
self.assertEqual(any([]), False) # Empty iterator
self.assertEqual(any([1, TestFailingBool()]), True) # Short-circuit
S = [40, 60, 30]
self.assertEqual(any(x > 42 for x in S), True)
S = [10, 20, 30]
Expand Down
1 change: 1 addition & 0 deletions Misc/ACKS
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@ Jonathan Giddy
Johannes Gijsbers
Michael Gilfix
Matt Giuca
Wim Glenn
Christoph Gohlke
Tim Golden
Guilherme Gonçalves
Expand Down

0 comments on commit 0f4377c

Please sign in to comment.