diff options
| author | Serhiy Storchaka <storchaka@gmail.com> | 2019-09-25 15:35:57 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-09-25 15:35:57 (GMT) |
| commit | 543a3951a1c96bae0ea839eacec71d3b1a563a10 (patch) | |
| tree | 1c2fb6fc61e55798671b768de44c6a1f4d67d70b /Lib/test/test__xxsubinterpreters.py | |
| parent | 15ccc4fac09b866d61b069c6c136aabfe4bac09c (diff) | |
| download | cpython-543a3951a1c96bae0ea839eacec71d3b1a563a10.zip cpython-543a3951a1c96bae0ea839eacec71d3b1a563a10.tar.gz cpython-543a3951a1c96bae0ea839eacec71d3b1a563a10.tar.bz2 | |
bpo-38005: Remove support of string argument in InterpreterID(). (GH-16227)
Make negative interpreter id to raise ValueError instead of RuntimeError.
Diffstat (limited to 'Lib/test/test__xxsubinterpreters.py')
| -rw-r--r-- | Lib/test/test__xxsubinterpreters.py | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/Lib/test/test__xxsubinterpreters.py b/Lib/test/test__xxsubinterpreters.py index f5474f4..207b5db 100644 --- a/Lib/test/test__xxsubinterpreters.py +++ b/Lib/test/test__xxsubinterpreters.py @@ -514,7 +514,7 @@ class IsRunningTests(TestBase): interpreters.is_running(1_000_000) def test_bad_id(self): - with self.assertRaises(RuntimeError): + with self.assertRaises(ValueError): interpreters.is_running(-1) @@ -530,18 +530,15 @@ class InterpreterIDTests(TestBase): def __index__(self): return 10 - for id in ('10', '1_0', Int()): - with self.subTest(id=id): - id = interpreters.InterpreterID(id, force=True) - self.assertEqual(int(id), 10) + id = interpreters.InterpreterID(Int(), force=True) + self.assertEqual(int(id), 10) def test_bad_id(self): self.assertRaises(TypeError, interpreters.InterpreterID, object()) self.assertRaises(TypeError, interpreters.InterpreterID, 10.0) + self.assertRaises(TypeError, interpreters.InterpreterID, '10') self.assertRaises(TypeError, interpreters.InterpreterID, b'10') self.assertRaises(ValueError, interpreters.InterpreterID, -1) - self.assertRaises(ValueError, interpreters.InterpreterID, '-1') - self.assertRaises(ValueError, interpreters.InterpreterID, 'spam') self.assertRaises(OverflowError, interpreters.InterpreterID, 2**64) def test_does_not_exist(self): @@ -720,7 +717,7 @@ class DestroyTests(TestBase): interpreters.destroy(1_000_000) def test_bad_id(self): - with self.assertRaises(RuntimeError): + with self.assertRaises(ValueError): interpreters.destroy(-1) def test_from_current(self): @@ -863,7 +860,7 @@ class RunStringTests(TestBase): interpreters.run_string(id, 'print("spam")') def test_error_id(self): - with self.assertRaises(RuntimeError): + with self.assertRaises(ValueError): interpreters.run_string(-1, 'print("spam")') def test_bad_id(self): |
