code: def test_finalize_options(self):
      # Make sure Python's include directories (for Python.h, pyconfig.h,
      # etc.) are in the include search path.
      modules = [Extension("foo", ["xxx"])]
      dist = Distribution({"name": "xx", "ext_modules": modules})
      cmd = build_ext(dist)
      cmd.finalize_options()
  
      py_include = sysconfig.get_python_inc()
      self.assertIn(py_include, cmd.include_dirs)
  
      plat_py_include = sysconfig.get_python_inc(plat_specific=1)
      self.assertIn(plat_py_include, cmd.include_dirs)
  
      # make sure cmd.libraries is turned into a list
      # if it's a string
      cmd = build_ext(dist)
      cmd.libraries = "my_lib, other_lib lastlib"
      cmd.finalize_options()
      self.assertEqual(
          cmd.libraries, ["my_lib", "other_lib", "lastlib"]
      )
  
      # make sure cmd.library_dirs is turned into a list
      # if it's a string
      cmd = build_ext(dist)
      cmd.library_dirs = "my_lib_dir%sother_lib_dir" % os.pathsep
      cmd.finalize_options()
      self.assertIn("my_lib_dir", cmd.library_dirs)
      self.assertIn("other_lib_dir", cmd.library_dirs)
  
      # make sure rpath is turned into a list
      # if it's a string
      cmd = build_ext(dist)
      cmd.rpath = "one%stwo" % os.pathsep
      cmd.finalize_options()
      self.assertEqual(cmd.rpath, ["one", "two"])
  
      # make sure cmd.link_objects is turned into a list
      # if it's a string
      cmd = build_ext(dist)
      cmd.link_objects = "one two,three"
      cmd.finalize_options()
      self.assertEqual(cmd.link_objects, ["one", "two", "three"])
  
      # XXX more tests to perform for win32
  
      # make sure define is turned into 2-tuples
      # strings if they are ','-separated strings
      cmd = build_ext(dist)
      cmd.define = "one,two"
      cmd.finalize_options()
      self.assertEqual(cmd.define, [("one", "1"), ("two", "1")])
  
      # make sure undef is turned into a list of
      # strings if they are ','-separated strings
      cmd = build_ext(dist)
      cmd.undef = "one,two"
      cmd.finalize_options()
      self.assertEqual(cmd.undef, ["one", "two"])
  
      # make sure swig_opts is turned into a list
      cmd = build_ext(dist)
      cmd.swig_opts = None
      cmd.finalize_options()
      self.assertEqual(cmd.swig_opts, [])
  
      cmd = build_ext(dist)
      cmd.swig_opts = "1 2"
      cmd.finalize_options()
      self.assertEqual(cmd.swig_opts, ["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 6 for calling the BuildExtTestCase obj's underlying member method code with example usage: obj.test_finalize_options() without return types