@@ -48,11 +48,19 @@ def test_map(self):
4848 list (map (pow , range (10 ), range (10 ))))
4949
5050 def test_map_exception (self ):
51- i = self .executor .map (divmod , [1 , 1 , 1 , 1 ], [2 , 3 , 0 , 5 ])
52- self .assertEqual (i .__next__ (), (0 , 1 ))
53- self .assertEqual (i .__next__ (), (0 , 1 ))
51+ i = self .executor .map (divmod , [5 , 5 , 5 , 5 ], [2 , 3 , 0 , 5 ])
52+ self .assertEqual (i .__next__ (), (2 , 1 ))
53+ self .assertEqual (i .__next__ (), (1 , 2 ))
5454 self .assertRaises (ZeroDivisionError , i .__next__ )
55- self .assertEqual (i .__next__ (), (0 , 1 ))
55+ self .assertEqual (i .__next__ (), (1 , 0 ))
56+ self .assertRaises (StopIteration , i .__next__ )
57+ self .assertRaises (StopIteration , i .__next__ )
58+
59+ i = self .executor .map (divmod , [5 , 5 , 5 , 5 ], [2 , 0 , 3 , 5 ], chunksize = 3 )
60+ self .assertEqual (i .__next__ (), (2 , 1 ))
61+ self .assertRaises (ZeroDivisionError , i .__next__ )
62+ self .assertEqual (i .__next__ (), (1 , 2 ))
63+ self .assertEqual (i .__next__ (), (1 , 0 ))
5664 self .assertRaises (StopIteration , i .__next__ )
5765 self .assertRaises (StopIteration , i .__next__ )
5866
@@ -71,6 +79,19 @@ def test_map_timeout(self):
7179
7280 self .assertEqual ([None , None ], results )
7381
82+ def test_map_close (self ):
83+ i = self .executor .map (divmod , [5 , 5 , 5 , 5 ], [2 , 0 , 3 , 5 ])
84+ self .assertEqual (i .__next__ (), (2 , 1 ))
85+ i .close ()
86+ self .assertRaises (StopIteration , i .__next__ )
87+ self .assertRaises (StopIteration , i .__next__ )
88+
89+ i = self .executor .map (divmod , [5 , 5 , 5 , 5 ], [2 , 0 , 3 , 5 ], chunksize = 3 )
90+ self .assertEqual (i .__next__ (), (2 , 1 ))
91+ i .close ()
92+ self .assertRaises (StopIteration , i .__next__ )
93+ self .assertRaises (StopIteration , i .__next__ )
94+
7495 def test_shutdown_race_issue12456 (self ):
7596 # Issue #12456: race condition at shutdown where trying to post a
7697 # sentinel in the call queue blocks (the queue is full while processes
0 commit comments