@@ -1037,24 +1037,27 @@ def setup_class(cls):
10371037 cls .b = a .subs ({cls .u : - 5 * cls .u .dx + 4 * cls .u + 3 }, postprocess = False )
10381038
10391039 def test_reconstructible (self ):
1040- ''' Check that devito.Derivatives are reconstructible from func and args
1040+ """
1041+ Check that devito.Derivatives are reconstructible from func and args
10411042 (as per sympy docs)
1042- '''
1043+ """
10431044 du = self .u .dx
10441045 assert du .func (* du .args ) == du
10451046 assert du .func (* du .args ).args == (self .u , (self .x , 1 ))
10461047
10471048 def test_deriv_order (self ):
1048- ''' Check default simplification causes the same result
1049- '''
1049+ """
1050+ Check default simplification causes the same result
1051+ """
10501052 du11 = Derivative (self .u , self .x , self .x )
10511053 du2 = Derivative (self .u , (self .x , 2 ))
10521054 assert du11 == du2
10531055 assert du11 .deriv_order == du2 .deriv_order
10541056
10551057 def test_wrong_deriv_order (self ):
1056- ''' Check an exception is raises with incompatible arguments
1057- '''
1058+ """
1059+ Check an exception is raises with incompatible arguments
1060+ """
10581061 with pytest .raises (ValueError ):
10591062 _ = Derivative (self .u , self .x , deriv_order = (2 , 4 ))
10601063
@@ -1067,15 +1070,17 @@ def test_no_dimension(self):
10671070 _ = Derivative (sympify (- 1 ), deriv_order = 0 )
10681071
10691072 def test_constant (self ):
1070- ''' Check constant derivative is zero for non-0th order derivatives
1071- '''
1073+ """
1074+ Check constant derivative is zero for non-0th order derivatives
1075+ """
10721076 assert Derivative (sympify (- 1 ), (self .x , 1 )) == 0
10731077 assert Derivative (sympify (- 1 ), (self .x , 2 )) == 0
10741078 assert Derivative (sympify (- 1 ), (self .x , 0 )) == - 1
10751079
10761080 def test_dims_validation (self ):
1077- ''' Validate `dims` kwarg
1078- '''
1081+ """
1082+ Validate `dims` kwarg
1083+ """
10791084 grid = Grid (shape = (11 , 11 , 11 ), extent = (1 , 1 , 1 ))
10801085 x , y , z = grid .dimensions
10811086 u = Function (name = 'u' , grid = grid , space_order = 4 )
@@ -1101,8 +1106,9 @@ def test_dims_validation(self):
11011106 assert d .deriv_order == (3 , 1 , 3 )
11021107
11031108 def test_dims_exceptions (self ):
1104- ''' Check invalid dimensions and orders raise exceptions
1105- '''
1109+ """
1110+ Check invalid dimensions and orders raise exceptions
1111+ """
11061112 grid = Grid (shape = (11 , 11 , 11 ), extent = (1 , 1 , 1 ))
11071113 x , y , z = grid .dimensions
11081114 u = Function (name = 'u' , grid = grid , space_order = 4 )
@@ -1126,29 +1132,33 @@ def test_dims_exceptions(self):
11261132 _ = Derivative (u , (x , a ))
11271133
11281134 def test_expand_mul (self ):
1129- ''' Check independent terms can be extracted from the derivative.
1135+ """
1136+ Check independent terms can be extracted from the derivative.
11301137 The multiply expansion is the only hint executed by default when
11311138 `.expand()` is called.
1132- '''
1139+ """
11331140 expanded = Derivative (4 * self .u - 5 * Derivative (self .u , self .x ) + 3 , self .x )
11341141 assert self .b .expand () == expanded
11351142
11361143 def test_expand_add (self ):
1137- ''' Check linearity
1138- '''
1144+ """
1145+ Check linearity
1146+ """
11391147 expanded = 4 * Derivative (self .u , self .x )
11401148 expanded -= 5 * Derivative (Derivative (self .u , self .x ), self .x )
11411149 assert self .b .expand (add = True ) == expanded
11421150
11431151 def test_expand_nest (self ):
1144- ''' Check valid nested derivative expands (combining x derivatives)
1145- '''
1152+ """
1153+ Check valid nested derivative expands (combining x derivatives)
1154+ """
11461155 expanded = 4 * Derivative (self .u , self .x ) - 5 * Derivative (self .u , (self .x , 2 ))
11471156 assert self .b .expand (add = True , nest = True ) == expanded
11481157
11491158 def test_nested_orders (self ):
1150- ''' Check nested expansion results in correct derivative and fd order
1151- '''
1159+ """
1160+ Check nested expansion results in correct derivative and fd order
1161+ """
11521162 # Default fd_order
11531163 du22 = Derivative (Derivative (self .u , (self .x , 2 )), (self .x , 2 ))
11541164 with pytest .warns (UserWarning ):
0 commit comments