File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1799,17 +1799,23 @@ def test_imap_unordered_handle_iterable_exception(self):
17991799 it = self .pool .imap_unordered (sqr ,
18001800 exception_throwing_generator (10 , 3 ),
18011801 1 )
1802+ expected_values = list (map (sqr , list (range (10 ))))
18021803 with self .assertRaises (SayWhenError ):
18031804 # imap_unordered makes it difficult to anticipate the SayWhenError
18041805 for i in range (10 ):
1805- self .assertEqual (next (it ), i * i )
1806+ value = next (it )
1807+ self .assertIn (value , expected_values )
1808+ expected_values .remove (value )
18061809
18071810 it = self .pool .imap_unordered (sqr ,
18081811 exception_throwing_generator (20 , 7 ),
18091812 2 )
1813+ expected_values = list (map (sqr , list (range (20 ))))
18101814 with self .assertRaises (SayWhenError ):
18111815 for i in range (20 ):
1812- self .assertEqual (next (it ), i * i )
1816+ value = next (it )
1817+ self .assertIn (value , expected_values )
1818+ expected_values .remove (value )
18131819
18141820 def test_make_pool (self ):
18151821 self .assertRaises (ValueError , multiprocessing .Pool , - 1 )
You can’t perform that action at this time.
0 commit comments