diff options
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_bool.py | 4 | ||||
-rw-r--r-- | Lib/test/test_float.py | 4 | ||||
-rw-r--r-- | Lib/test/test_int.py | 8 | ||||
-rw-r--r-- | Lib/test/test_list.py | 5 | ||||
-rw-r--r-- | Lib/test/test_tuple.py | 5 |
5 files changed, 12 insertions, 14 deletions
diff --git a/Lib/test/test_bool.py b/Lib/test/test_bool.py index 1e6ec19..c5a1f1f 100644 --- a/Lib/test/test_bool.py +++ b/Lib/test/test_bool.py @@ -171,8 +171,8 @@ class BoolTest(unittest.TestCase): self.assertIs(bool(), False) def test_keyword_args(self): - with self.assertWarns(DeprecationWarning): - self.assertIs(bool(x=10), True) + with self.assertRaisesRegex(TypeError, 'keyword argument'): + bool(x=10) def test_format(self): self.assertEqual("%d" % False, "0") diff --git a/Lib/test/test_float.py b/Lib/test/test_float.py index 91e3b7a..238fdf7 100644 --- a/Lib/test/test_float.py +++ b/Lib/test/test_float.py @@ -209,8 +209,8 @@ class GeneralFloatCases(unittest.TestCase): self.assertIs(type(FloatSubclass(F())), FloatSubclass) def test_keyword_args(self): - with self.assertWarns(DeprecationWarning): - self.assertEqual(float(x='3.14'), 3.14) + with self.assertRaisesRegex(TypeError, 'keyword argument'): + float(x='3.14') def test_is_integer(self): self.assertFalse((1.1).is_integer()) diff --git a/Lib/test/test_int.py b/Lib/test/test_int.py index db96967..854117e 100644 --- a/Lib/test/test_int.py +++ b/Lib/test/test_int.py @@ -246,11 +246,11 @@ class IntTestCases(unittest.TestCase): def test_keyword_args(self): # Test invoking int() using keyword arguments. - with self.assertWarns(DeprecationWarning): - self.assertEqual(int(x=1.2), 1) self.assertEqual(int('100', base=2), 4) - with self.assertWarns(DeprecationWarning): - self.assertEqual(int(x='100', base=2), 4) + with self.assertRaisesRegex(TypeError, 'keyword argument'): + int(x=1.2) + with self.assertRaisesRegex(TypeError, 'keyword argument'): + int(x='100', base=2) 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 48c3691..def4bad 100644 --- a/Lib/test/test_list.py +++ b/Lib/test/test_list.py @@ -42,9 +42,8 @@ class ListTest(list_tests.CommonTest): 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]) + with self.assertRaisesRegex(TypeError, 'keyword argument'): + list(sequence=[]) def test_truth(self): super().test_truth() diff --git a/Lib/test/test_tuple.py b/Lib/test/test_tuple.py index d3663ac..84c064f 100644 --- a/Lib/test/test_tuple.py +++ b/Lib/test/test_tuple.py @@ -27,9 +27,8 @@ class TupleTest(seq_tests.CommonTest): (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)) + with self.assertRaisesRegex(TypeError, 'keyword argument'): + tuple(sequence=()) def test_truth(self): super().test_truth() |