summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_range.py
diff options
context:
space:
mode:
authorPablo Galindo <Pablogsal@gmail.com>2020-01-05 17:30:53 (GMT)
committerGitHub <noreply@github.com>2020-01-05 17:30:53 (GMT)
commit4b66fa6ce9c37e70b55af220d0e07368319de803 (patch)
treee6863cade7856b951c4ee966df8b43fd8b6d5419 /Lib/test/test_range.py
parentb121a4a45ff4bab8812a9b26ceffe5ad642f5d5a (diff)
downloadcpython-4b66fa6ce9c37e70b55af220d0e07368319de803.zip
cpython-4b66fa6ce9c37e70b55af220d0e07368319de803.tar.gz
cpython-4b66fa6ce9c37e70b55af220d0e07368319de803.tar.bz2
bpo-39200: Correct the error message for range() empty constructor (GH-17813)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Diffstat (limited to 'Lib/test/test_range.py')
-rw-r--r--Lib/test/test_range.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_range.py b/Lib/test/test_range.py
index 73cbcc4..30fa129 100644
--- a/Lib/test/test_range.py
+++ b/Lib/test/test_range.py
@@ -91,6 +91,19 @@ class RangeTest(unittest.TestCase):
r = range(-sys.maxsize, sys.maxsize, 2)
self.assertEqual(len(r), sys.maxsize)
+ def test_range_constructor_error_messages(self):
+ with self.assertRaisesRegex(
+ TypeError,
+ "range expected at least 1 argument, got 0"
+ ):
+ range()
+
+ with self.assertRaisesRegex(
+ TypeError,
+ "range expected at most 3 arguments, got 6"
+ ):
+ range(1, 2, 3, 4, 5, 6)
+
def test_large_operands(self):
x = range(10**20, 10**20+10, 3)
self.assertEqual(len(x), 4)