1919
2020from numpy .testing import assert_allclose , assert_array_equal
2121
22- from distarray .testing import DefaultContextTestCase , IPythonContextTestCase , check_targets
22+ from distarray .testing import (DefaultContextTestCase , IPythonContextTestCase ,
23+ check_targets )
2324from distarray .globalapi .context import Context
2425from distarray .globalapi .maps import Distribution
2526from distarray .mpionly_utils import is_solo_mpi_process
@@ -53,7 +54,7 @@ def test_local_sin(self):
5354 def local_sin (da ):
5455 return numpy .sin (da )
5556 self .context .register (local_sin )
56-
57+
5758 db = self .context .local_sin (self .da )
5859 assert_allclose (0 , db .tondarray (), atol = 1e-14 )
5960
@@ -132,7 +133,8 @@ def local_add_supermix(da, num1, db, num2, dc, num3=99, num4=66):
132133 dm .fill (22 )
133134 dn = self .context .empty (self .da .distribution )
134135 dn .fill (44 )
135- do = self .context .local_add_supermix (self .da , 11 , dm , 33 , dc = dn , num3 = 55 )
136+ do = self .context .local_add_supermix (self .da , 11 , dm ,
137+ 33 , dc = dn , num3 = 55 )
136138 expected = 2 * numpy .pi + 11 + 22 + 33 + 44 + 55 + 66
137139 assert_allclose (do .tondarray (), expected )
138140
@@ -146,7 +148,7 @@ def local_none(da):
146148 self .assertTrue (dp is None )
147149
148150 def test_parameterless (self ):
149-
151+
150152 def parameterless ():
151153 """This is a parameterless function."""
152154 return None
@@ -304,10 +306,10 @@ def test_2D(self):
304306 def test_3D (self ):
305307 a = self .context .empty ((3 , 3 , 3 ))
306308 db = Distribution (self .context , (3 , 3 , 3 ),
307- dist = ('n' , 'b' , 'n' ))
309+ dist = ('n' , 'b' , 'n' ))
308310 b = self .context .empty (db )
309311 dc = Distribution (self .context , (3 , 3 , 3 ),
310- dist = ('n' , 'n' , 'b' ))
312+ dist = ('n' , 'n' , 'b' ))
311313 c = self .context .empty (dc )
312314 self .assertEqual (a .grid_shape , (3 , 1 , 1 ))
313315 self .assertEqual (b .grid_shape , (1 , 3 , 1 ))
@@ -402,18 +404,21 @@ def foo():
402404
403405 def test_apply_distarray (self ):
404406
405- da = self .context .empty ((len (self .context .targets ),), dtype = numpy .uint32 )
407+ da = self .context .empty ((len (self .context .targets ),),
408+ dtype = numpy .uint32 )
406409
407410 def local_label (la ):
408411 la .ndarray .fill (la .comm .rank )
409412
410- # Testing that we can pass in `da` and `apply()` extracts `da.key` automatically.
413+ # Testing that we can pass in `da`
414+ # and `apply()` extracts `da.key` automatically.
411415 self .context .apply (local_label , (da ,))
412416 assert_array_equal (da .tondarray (), range (len (self .context .targets )))
413417
414418 self .context .apply (local_label , kwargs = {'la' : da })
415419 assert_array_equal (da .tondarray (), range (len (self .context .targets )))
416420
421+
417422class TestGetBaseComm (DefaultContextTestCase ):
418423
419424 ntargets = 'any'
0 commit comments