@@ -362,13 +362,15 @@ def test_bad_id(self):
362
362
def test_from_current (self ):
363
363
main , = interpreters .list_all ()
364
364
id = interpreters .create ()
365
- script = dedent ("""
365
+ script = dedent (f """
366
366
import _xxsubinterpreters as _interpreters
367
- _interpreters.destroy({})
368
- """ ).format (id )
367
+ try:
368
+ _interpreters.destroy({ id } )
369
+ except RuntimeError:
370
+ pass
371
+ """ )
369
372
370
- with self .assertRaises (RuntimeError ):
371
- interpreters .run_string (id , script )
373
+ interpreters .run_string (id , script )
372
374
self .assertEqual (set (interpreters .list_all ()), {main , id })
373
375
374
376
def test_from_sibling (self ):
@@ -761,12 +763,12 @@ def __int__(self):
761
763
self .assertEqual (int (cid ), 10 )
762
764
763
765
def test_bad_id (self ):
764
- ids = [- 1 , 2 ** 64 , "spam" ]
765
- for cid in ids :
766
+ for cid in [- 1 , 'spam' ]:
766
767
with self .subTest (cid ):
767
768
with self .assertRaises (ValueError ):
768
769
interpreters ._channel_id (cid )
769
-
770
+ with self .assertRaises (OverflowError ):
771
+ interpreters ._channel_id (2 ** 64 )
770
772
with self .assertRaises (TypeError ):
771
773
interpreters ._channel_id (object ())
772
774
0 commit comments