summaryrefslogtreecommitdiff
path: root/Lib/test
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_bool.py4
-rw-r--r--Lib/test/test_float.py4
-rw-r--r--Lib/test/test_int.py6
-rw-r--r--Lib/test/test_list.py7
-rw-r--r--Lib/test/test_tuple.py7
5 files changed, 26 insertions, 2 deletions
diff --git a/Lib/test/test_bool.py b/Lib/test/test_bool.py
index 9f8f0e122c..1e6ec19837 100644
--- a/Lib/test/test_bool.py
+++ b/Lib/test/test_bool.py
@@ -170,6 +170,10 @@ class BoolTest(unittest.TestCase):
self.assertIs(bool(""), False)
self.assertIs(bool(), False)
+ def test_keyword_args(self):
+ with self.assertWarns(DeprecationWarning):
+ self.assertIs(bool(x=10), True)
+
def test_format(self):
self.assertEqual("%d" % False, "0")
self.assertEqual("%d" % True, "1")
diff --git a/Lib/test/test_float.py b/Lib/test/test_float.py
index ac8473db50..91e3b7ab49 100644
--- a/Lib/test/test_float.py
+++ b/Lib/test/test_float.py
@@ -208,6 +208,10 @@ class GeneralFloatCases(unittest.TestCase):
with self.assertWarns(DeprecationWarning):
self.assertIs(type(FloatSubclass(F())), FloatSubclass)
+ def test_keyword_args(self):
+ with self.assertWarns(DeprecationWarning):
+ self.assertEqual(float(x='3.14'), 3.14)
+
def test_is_integer(self):
self.assertFalse((1.1).is_integer())
self.assertTrue((1.).is_integer())
diff --git a/Lib/test/test_int.py b/Lib/test/test_int.py
index 14bbd6192a..db969672e4 100644
--- a/Lib/test/test_int.py
+++ b/Lib/test/test_int.py
@@ -246,9 +246,11 @@ class IntTestCases(unittest.TestCase):
def test_keyword_args(self):
# Test invoking int() using keyword arguments.
- self.assertEqual(int(x=1.2), 1)
+ with self.assertWarns(DeprecationWarning):
+ self.assertEqual(int(x=1.2), 1)
self.assertEqual(int('100', base=2), 4)
- self.assertEqual(int(x='100', base=2), 4)
+ with self.assertWarns(DeprecationWarning):
+ self.assertEqual(int(x='100', base=2), 4)
self.assertRaises(TypeError, int, base=10)
self.assertRaises(TypeError, int, base=0)
diff --git a/Lib/test/test_list.py b/Lib/test/test_list.py
index aee62dca1c..48c36913c0 100644
--- a/Lib/test/test_list.py
+++ b/Lib/test/test_list.py
@@ -16,6 +16,8 @@ class ListTest(list_tests.CommonTest):
self.assertEqual(list((0, 1, 2, 3)), [0, 1, 2, 3])
self.assertEqual(list(''), [])
self.assertEqual(list('spam'), ['s', 'p', 'a', 'm'])
+ self.assertEqual(list(x for x in range(10) if x % 2),
+ [1, 3, 5, 7, 9])
if sys.maxsize == 0x7fffffff:
# This test can currently only work on 32-bit machines.
@@ -39,6 +41,11 @@ class ListTest(list_tests.CommonTest):
x.extend(-y for y in x)
self.assertEqual(x, [])
+ def test_keyword_args(self):
+ with self.assertWarns(DeprecationWarning):
+ self.assertEqual(list(sequence=(x for x in range(10) if x % 2)),
+ [1, 3, 5, 7, 9])
+
def test_truth(self):
super().test_truth()
self.assertTrue(not [])
diff --git a/Lib/test/test_tuple.py b/Lib/test/test_tuple.py
index 5d1fcf68a8..d3663acfd4 100644
--- a/Lib/test/test_tuple.py
+++ b/Lib/test/test_tuple.py
@@ -23,6 +23,13 @@ class TupleTest(seq_tests.CommonTest):
self.assertEqual(tuple([0, 1, 2, 3]), (0, 1, 2, 3))
self.assertEqual(tuple(''), ())
self.assertEqual(tuple('spam'), ('s', 'p', 'a', 'm'))
+ self.assertEqual(tuple(x for x in range(10) if x % 2),
+ (1, 3, 5, 7, 9))
+
+ def test_keyword_args(self):
+ with self.assertWarns(DeprecationWarning):
+ self.assertEqual(tuple(sequence=(x for x in range(10) if x % 2)),
+ (1, 3, 5, 7, 9))
def test_truth(self):
super().test_truth()