We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a3e303f commit a6b1b8aCopy full SHA for a6b1b8a
tests/test_future/test_min_max.py
@@ -0,0 +1,25 @@
1
+# -*- coding: utf-8 -*-
2
+"""
3
+Tests for the min and max functions with `default` keyword.
4
5
+
6
+from __future__ import absolute_import, unicode_literals, print_function
7
+from future.builtins import *
8
+from future.tests.base import unittest
9
10
11
+class TestMinMax(unittest.TestCase):
12
+ def test_default(self):
13
+ self.assertEqual(min([], default=3), 3)
14
+ self.assertEqual(max([], default=3), 3)
15
16
+ def test_generator(self):
17
+ """
18
+ Issue #510
19
20
+ self.assertEqual(max((x for x in [3, 2, 1])), 3)
21
+ self.assertEqual(min((x for x in [1, 2, 3])), 1)
22
23
+ def test_empty_generator(self):
24
+ with self.assertRaises(ValueError):
25
+ min(x for x in [])
0 commit comments