code: def test_check_extensions_list(self):
      dist = Distribution()
      cmd = build_ext(dist)
      cmd.finalize_options()
  
      #'extensions' option must be a list of Extension instances
      self.assertRaises(
          DistutilsSetupError, cmd.check_extensions_list, "foo"
      )
  
      # each element of 'ext_modules' option must be an
      # Extension instance or 2-tuple
      exts = [("bar", "foo", "bar"), "foo"]
      self.assertRaises(
          DistutilsSetupError, cmd.check_extensions_list, exts
      )
  
      # first element of each tuple in 'ext_modules'
      # must be the extension name (a string) and match
      # a python dotted-separated name
      exts = [("foo-bar", "")]
      self.assertRaises(
          DistutilsSetupError, cmd.check_extensions_list, exts
      )
  
      # second element of each tuple in 'ext_modules'
      # must be a dictionary (build info)
      exts = [("foo.bar", "")]
      self.assertRaises(
          DistutilsSetupError, cmd.check_extensions_list, exts
      )
  
      # ok this one should pass
      exts = [
          (
              "foo.bar",
              {"sources": [""], "libraries": "foo", "some": "bar"},
          )
      ]
      cmd.check_extensions_list(exts)
      ext = exts[0]
      self.assertIsInstance(ext, Extension)
  
      # check_extensions_list adds in ext the values passed
      # when they are in ('include_dirs', 'library_dirs', 'libraries'
      # 'extra_objects', 'extra_compile_args', 'extra_link_args')
      self.assertEqual(ext.libraries, "foo")
      self.assertFalse(hasattr(ext, "some"))
  
      # 'macros' element of build info dict must be 1- or 2-tuple
      exts = [
          (
              "foo.bar",
              {
                  "sources": [""],
                  "libraries": "foo",
                  "some": "bar",
                  "macros": [("1", "2", "3"), "foo"],
              },
          )
      ]
      self.assertRaises(
          DistutilsSetupError, cmd.check_extensions_list, exts
      )
  
      exts[0][1]["macros"] = [("1", "2"), ("3",)]
      cmd.check_extensions_list(exts)
      self.assertEqual(exts[0].undef_macros, ["3"])
      self.assertEqual(exts[0].define_macros, [("1", "2")])
  
imports: import sys
  import os
  from StringIO import StringIO
  import textwrap
  from distutils.core import Extension, Distribution
  from distutils.command.build_ext import build_ext
  from distutils import sysconfig
  from distutils.tests import support
  from distutils.errors import DistutilsSetupError, CompileError, DistutilsPlatformError
  import unittest
  from test import test_support
label_desc: Use image node_id 7 for calling the BuildExtTestCase obj's underlying member method code with example usage: obj.test_check_extensions_list() without return types