code: def test_in_class_scope_with_global(self):
      code = """
              y = 1
              class C:
                  global y
                  y = 2
                  # Ensure the listcomp uses the global, not the value in the
                  # class namespace
                  locals()['y'] = 3
                  vals = [(x, y) for x in range(2)]
              vals = C.vals
          """
      outputs = {"vals": [(0, 2), (1, 2)]}
      self._check_in_scopes(code, outputs, scopes=["module", "class"])
      outputs = {"vals": [(0, 1), (1, 1)]}
      self._check_in_scopes(code, outputs, scopes=["function"])
  
imports: import doctest
  import textwrap
  import types
  import unittest
label_desc: Use image node_id 35 for calling the ListComprehensionTest obj's underlying member method code with example usage: obj.test_in_class_scope_with_global() without return types