@@ -31,11 +31,11 @@ class IsTestBase(unittest.TestCase):
3131 predicates = set ([inspect .isbuiltin , inspect .isclass , inspect .iscode ,
3232 inspect .isframe , inspect .isfunction , inspect .ismethod ,
3333 inspect .ismodule , inspect .istraceback ])
34-
34+
3535 def istest (self , predicate , exp ):
3636 obj = eval (exp )
3737 self .failUnless (predicate (obj ), '%s(%s)' % (predicate .__name__ , exp ))
38-
38+
3939 for other in self .predicates - set ([predicate ]):
4040 self .failIf (other (obj ), 'not %s(%s)' % (other .__name__ , exp ))
4141
@@ -44,7 +44,7 @@ def test_eleven(self):
4444 # Doc/lib/libinspect.tex claims there are 11 such functions
4545 count = len (filter (lambda x :x .startswith ('is' ), dir (inspect )))
4646 self .assertEqual (count , 11 , "There are %d (not 11) is* functions" % count )
47-
47+
4848 def test_excluding_predicates (self ):
4949 self .istest (inspect .isbuiltin , 'sys.exit' )
5050 self .istest (inspect .isbuiltin , '[].append' )
@@ -66,7 +66,7 @@ def test_isroutine(self):
6666class TestInterpreterStack (IsTestBase ):
6767 def __init__ (self , * args , ** kwargs ):
6868 unittest .TestCase .__init__ (self , * args , ** kwargs )
69-
69+
7070 git .abuse (7 , 8 , 9 )
7171
7272 def test_abuse_done (self ):
@@ -76,7 +76,7 @@ def test_abuse_done(self):
7676 def test_stack (self ):
7777 self .assert_ (len (mod .st ) >= 5 )
7878 self .assertEqual (mod .st [0 ][1 :],
79- (modfile , 16 , 'eggs' , [' st = inspect.stack()\n ' ], 0 ))
79+ (modfile , 16 , 'eggs' , [' st = inspect.stack()\n ' ], 0 ))
8080 self .assertEqual (mod .st [1 ][1 :],
8181 (modfile , 9 , 'spam' , [' eggs(b + d, c + f)\n ' ], 0 ))
8282 self .assertEqual (mod .st [2 ][1 :],
@@ -113,7 +113,7 @@ def test_previous_frame(self):
113113class GetSourceBase (unittest .TestCase ):
114114 # Subclasses must override.
115115 fodderFile = None
116-
116+
117117 def __init__ (self , * args , ** kwargs ):
118118 unittest .TestCase .__init__ (self , * args , ** kwargs )
119119
@@ -126,10 +126,10 @@ def sourcerange(self, top, bottom):
126126 def assertSourceEqual (self , obj , top , bottom ):
127127 self .assertEqual (inspect .getsource (obj ),
128128 self .sourcerange (top , bottom ))
129-
129+
130130class TestRetrievingSourceCode (GetSourceBase ):
131131 fodderFile = mod
132-
132+
133133 def test_getclasses (self ):
134134 classes = inspect .getmembers (mod , inspect .isclass )
135135 self .assertEqual (classes ,
@@ -147,7 +147,7 @@ def test_getclasses(self):
147147 ]
148148 ]
149149 ])
150-
150+
151151 def test_getfunctions (self ):
152152 functions = inspect .getmembers (mod , inspect .isfunction )
153153 self .assertEqual (functions , [('eggs' , mod .eggs ),
@@ -172,8 +172,8 @@ def test_getsource(self):
172172 self .assertSourceEqual (mod .StupidGit , 21 , 46 )
173173
174174 def test_getsourcefile (self ):
175- self .assertEqual (inspect .getsourcefile (mod .spam ), modfile )
176- self .assertEqual (inspect .getsourcefile (git .abuse ), modfile )
175+ self .assertEqual (inspect .getsourcefile (mod .spam ), modfile )
176+ self .assertEqual (inspect .getsourcefile (git .abuse ), modfile )
177177
178178 def test_getfile (self ):
179179 self .assertEqual (inspect .getfile (mod .StupidGit ), mod .__file__ )
@@ -192,38 +192,38 @@ class TestOneliners(GetSourceBase):
192192 def test_oneline_lambda (self ):
193193 # Test inspect.getsource with a one-line lambda function.
194194 self .assertSourceEqual (mod2 .oll , 25 , 25 )
195-
195+
196196 def test_threeline_lambda (self ):
197197 # Test inspect.getsource with a three-line lambda function,
198198 # where the second and third lines are _not_ indented.
199- self .assertSourceEqual (mod2 .tll , 28 , 30 )
200-
199+ self .assertSourceEqual (mod2 .tll , 28 , 30 )
200+
201201 def test_twoline_indented_lambda (self ):
202202 # Test inspect.getsource with a two-line lambda function,
203203 # where the second line _is_ indented.
204204 self .assertSourceEqual (mod2 .tlli , 33 , 34 )
205-
205+
206206 def test_onelinefunc (self ):
207207 # Test inspect.getsource with a regular one-line function.
208208 self .assertSourceEqual (mod2 .onelinefunc , 37 , 37 )
209-
209+
210210 def test_manyargs (self ):
211211 # Test inspect.getsource with a regular function where
212212 # the arguments are on two lines and _not_ indented and
213213 # the body on the second line with the last arguments.
214214 self .assertSourceEqual (mod2 .manyargs , 40 , 41 )
215-
215+
216216 def test_twolinefunc (self ):
217217 # Test inspect.getsource with a regular function where
218218 # the body is on two lines, following the argument list and
219219 # continued on the next line by a \\.
220220 self .assertSourceEqual (mod2 .twolinefunc , 44 , 45 )
221-
221+
222222 def test_lambda_in_list (self ):
223223 # Test inspect.getsource with a one-line lambda function
224224 # defined in a list, indented.
225225 self .assertSourceEqual (mod2 .a [1 ], 49 , 49 )
226-
226+
227227 def test_anonymous (self ):
228228 # Test inspect.getsource with a lambda function defined
229229 # as argument to another function.
@@ -233,7 +233,7 @@ def test_anonymous(self):
233233def attrs_wo_objs (cls ):
234234 return [t [:3 ] for t in inspect .classify_class_attrs (cls )]
235235
236- class TestClassesAndFunctions (unittest .TestCase ):
236+ class TestClassesAndFunctions (unittest .TestCase ):
237237 def test_classic_mro (self ):
238238 # Test classic-class method resolution order.
239239 class A : pass
@@ -284,7 +284,7 @@ def m(self):
284284
285285 def test_getargspec_sublistofone (self ):
286286 def sublistOfOne ((foo )): return 1
287-
287+
288288 self .assertArgSpecEquals (sublistOfOne , [['foo' ]])
289289
290290 def test_classify_oldstyle (self ):
@@ -418,4 +418,3 @@ def test_main():
418418
419419if __name__ == "__main__" :
420420 test_main ()
421-
0 commit comments