@@ -284,6 +284,20 @@ def test_local(self):
284284 def test_free (self ):
285285 self .assertTrue (self .internal .lookup ("x" ).is_free ())
286286
287+ def test_cells (self ):
288+ #test for addition of is_cell() and get_cells()
289+ #see https://github.com/python/cpython/issues/143504
290+ code = """def outer():
291+ x=1
292+ def inner():
293+ return x"""
294+
295+ top = symtable .symtable (code ,"?" ,"exec" )
296+ outer = find_block (top , "outer" )
297+ self .assertIn ("x" ,outer .get_cells ())
298+ self .assertTrue (outer .lookup ("x" ).is_cell ())
299+ self .assertFalse (outer .lookup ("inner" ).is_cell ())
300+
287301 def test_referenced (self ):
288302 self .assertTrue (self .internal .lookup ("x" ).is_referenced ())
289303 self .assertTrue (self .spam .lookup ("internal" ).is_referenced ())
@@ -611,20 +625,6 @@ def test_filter_syntax_warnings_by_module(self):
611625 self .assertEqual (wm .filename , filename )
612626 self .assertIs (wm .category , SyntaxWarning )
613627
614- def test_cells (self ):
615- #test for addition of is_cell() and get_cells()
616- #see https://github.com/python/cpython/issues/143504
617- code = """def outer():
618- x=1
619- def inner():
620- return x"""
621-
622- top = symtable .symtable (code ,"?" ,"exec" )
623- outer = find_block (top , "outer" )
624- self .assertIn ("x" ,outer .get_cells ())
625- self .assertTrue (outer .lookup ("x" ).is_cell ())
626- self .assertFalse (outer .lookup ("inner" ).is_cell ())
627-
628628
629629class ComprehensionTests (unittest .TestCase ):
630630 def get_identifiers_recursive (self , st , res ):
0 commit comments