@@ -362,13 +362,15 @@ def test_bad_id(self):
362362 def test_from_current (self ):
363363 main , = interpreters .list_all ()
364364 id = interpreters .create ()
365- script = dedent ("""
365+ script = dedent (f """
366366 import _xxsubinterpreters as _interpreters
367- _interpreters.destroy({})
368- """ ).format (id )
367+ try:
368+ _interpreters.destroy({ id } )
369+ except RuntimeError:
370+ pass
371+ """ )
369372
370- with self .assertRaises (RuntimeError ):
371- interpreters .run_string (id , script )
373+ interpreters .run_string (id , script )
372374 self .assertEqual (set (interpreters .list_all ()), {main , id })
373375
374376 def test_from_sibling (self ):
@@ -761,12 +763,12 @@ def __int__(self):
761763 self .assertEqual (int (cid ), 10 )
762764
763765 def test_bad_id (self ):
764- ids = [- 1 , 2 ** 64 , "spam" ]
765- for cid in ids :
766+ for cid in [- 1 , 'spam' ]:
766767 with self .subTest (cid ):
767768 with self .assertRaises (ValueError ):
768769 interpreters ._channel_id (cid )
769-
770+ with self .assertRaises (OverflowError ):
771+ interpreters ._channel_id (2 ** 64 )
770772 with self .assertRaises (TypeError ):
771773 interpreters ._channel_id (object ())
772774
0 commit comments