Skip to content

Commit 421b70e

Browse files
Fix a test.
1 parent 234328d commit 421b70e

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

Lib/test/test__interpreters.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
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

Lib/test/test_interpreters/test_api.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -693,8 +693,7 @@ def test_dict_and_kwargs(self):
693693

694694
def test_not_shareable(self):
695695
interp = interpreters.create()
696-
# XXX TypeError?
697-
with self.assertRaises(ValueError):
696+
with self.assertRaises(interpreters.NotShareableError):
698697
interp.prepare_main(spam={'spam': 'eggs', 'foo': 'bar'})
699698

700699
# Make sure neither was actually bound.

0 commit comments

Comments
 (0)