1515
1616_interpreters = import_helper .import_module ('_interpreters' )
1717_testinternalcapi = import_helper .import_module ('_testinternalcapi' )
18- from _interpreters import InterpreterNotFoundError
18+ from _interpreters import InterpreterNotFoundError , NotShareableError
1919
2020
2121##################################
@@ -189,8 +189,9 @@ def test_non_shareable_int(self):
189189 ]
190190 for i in ints :
191191 with self .subTest (i ):
192- with self .assertRaises (OverflowError ) :
192+ with self .assertRaises (NotShareableError ) as cm :
193193 _testinternalcapi .get_crossinterp_data (i )
194+ self .assertIsInstance (cm .exception .__cause__ , OverflowError )
194195
195196 def test_bool (self ):
196197 self ._assert_values ([True , False ])
@@ -215,14 +216,12 @@ def test_tuples_containing_non_shareable_types(self):
215216 for s in non_shareables :
216217 value = tuple ([0 , 1.0 , s ])
217218 with self .subTest (repr (value )):
218- # XXX Assert the NotShareableError when it is exported
219- with self .assertRaises (ValueError ):
219+ with self .assertRaises (NotShareableError ):
220220 _testinternalcapi .get_crossinterp_data (value )
221221 # Check nested as well
222222 value = tuple ([0 , 1. , (s ,)])
223223 with self .subTest ("nested " + repr (value )):
224- # XXX Assert the NotShareableError when it is exported
225- with self .assertRaises (ValueError ):
224+ with self .assertRaises (NotShareableError ):
226225 _testinternalcapi .get_crossinterp_data (value )
227226
228227
0 commit comments