@@ -839,16 +839,9 @@ def test_bad_script(self):
839839 interp .exec (10 )
840840
841841 def test_bytes_for_script (self ):
842- r , w = self .pipe ()
843- RAN = b'R'
844- DONE = b'D'
845842 interp = interpreters .create ()
846- interp .exec (f"""if True:
847- import os
848- os.write({ w } , { RAN !r} )
849- """ )
850- os .write (w , DONE )
851- self .assertEqual (os .read (r , 1 ), RAN )
843+ with self .assertRaises (TypeError ):
844+ interp .exec (b'print("spam")' )
852845
853846 def test_with_background_threads_still_running (self ):
854847 r_interp , w_interp = self .pipe ()
@@ -1017,6 +1010,8 @@ def test_call(self):
10171010
10181011 for i , (callable , args , kwargs ) in enumerate ([
10191012 (call_func_noop , (), {}),
1013+ (call_func_return_shareable , (), {}),
1014+ (call_func_return_not_shareable , (), {}),
10201015 (Spam .noop , (), {}),
10211016 ]):
10221017 with self .subTest (f'success case #{ i + 1 } ' ):
@@ -1041,8 +1036,6 @@ def test_call(self):
10411036 (call_func_complex , ('custom' , 'spam!' ), {}),
10421037 (call_func_complex , ('custom-inner' , 'eggs!' ), {}),
10431038 (call_func_complex , ('???' ,), {'exc' : ValueError ('spam' )}),
1044- (call_func_return_shareable , (), {}),
1045- (call_func_return_not_shareable , (), {}),
10461039 ]):
10471040 with self .subTest (f'invalid case #{ i + 1 } ' ):
10481041 with self .assertRaises (Exception ):
@@ -1058,6 +1051,8 @@ def test_call_in_thread(self):
10581051
10591052 for i , (callable , args , kwargs ) in enumerate ([
10601053 (call_func_noop , (), {}),
1054+ (call_func_return_shareable , (), {}),
1055+ (call_func_return_not_shareable , (), {}),
10611056 (Spam .noop , (), {}),
10621057 ]):
10631058 with self .subTest (f'success case #{ i + 1 } ' ):
@@ -1084,8 +1079,6 @@ def test_call_in_thread(self):
10841079 (call_func_complex , ('custom' , 'spam!' ), {}),
10851080 (call_func_complex , ('custom-inner' , 'eggs!' ), {}),
10861081 (call_func_complex , ('???' ,), {'exc' : ValueError ('spam' )}),
1087- (call_func_return_shareable , (), {}),
1088- (call_func_return_not_shareable , (), {}),
10891082 ]):
10901083 with self .subTest (f'invalid case #{ i + 1 } ' ):
10911084 if args or kwargs :
@@ -1625,8 +1618,8 @@ def test_exec(self):
16251618 def test_call (self ):
16261619 with self .subTest ('no args' ):
16271620 interpid = _interpreters .create ()
1628- with self . assertRaises ( ValueError ):
1629- _interpreters . call ( interpid , call_func_return_shareable )
1621+ exc = _interpreters . call ( interpid , call_func_return_shareable )
1622+ self . assertIs ( exc , None )
16301623
16311624 with self .subTest ('uncaught exception' ):
16321625 interpid = _interpreters .create ()
0 commit comments