{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {},
  "_ordered_sections": [],
  "item_file": null,
  "item_line": null,
  "item_type": null,
  "aliases": [],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [],
  "signature": null,
  "references": null,
  "qa": "reference:swig.testing",
  "arbitrary": [
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Testing the numpy.i typemaps"
        }
      ],
      "level": 0,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Writing tests for the "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "numpy.i"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " "
            },
            {
              "__type": "Link",
              "__tag": 4049,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "SWIG"
                }
              ],
              "url": "https://www.swig.org/",
              "title": ""
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " interface file is a combinatorial headache.  At present, 12 different data types are supported, each with 74 different argument signatures, for a total of 888 typemaps supported \"out of the box\".  Each of these typemaps, in turn, might require several unit tests in order to verify expected behavior for both proper and improper inputs.  Currently, this results in more than 1,000 individual unit tests executed when "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "make test"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is run in the "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "numpy/tools/swig"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " subdirectory."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "To facilitate this many similar unit tests, some high-level programming techniques are employed, including C and "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "SWIG",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " macros, as well as Python inheritance.  The purpose of this document is to describe the testing infrastructure employed to verify that the "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "numpy.i"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " typemaps are working as expected."
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Introduction"
        }
      ],
      "level": 1,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "There are three independent testing frameworks supported, for one-, two-, and three-dimensional arrays respectively.  For one-dimensional arrays, there are two C++ files, a header and a source, named      "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "Vector.h\nVector.cxx",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "that contain prototypes and code for a variety of functions that have one-dimensional arrays as function arguments.  The file      "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "Vector.i",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "is a "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "SWIG",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " interface file that defines a python module "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "Vector"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " that wraps the functions in "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "Vector.h"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " while utilizing the typemaps in "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "numpy.i"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " to correctly handle the C arrays."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "Makefile"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " calls "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "swig"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " to generate "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "Vector.py"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "Vector_wrap.cxx"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", and also executes the "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "setup.py"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " script that compiles "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "Vector_wrap.cxx"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and links together the extension module "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "_Vector.so"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " or "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "_Vector.dylib"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", depending on the platform.  This extension module and the proxy file "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "Vector.py"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " are both placed in a subdirectory under the "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "build"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " directory."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The actual testing takes place with a Python script named      "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "testVector.py",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "that uses the standard Python library module "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "unittest"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", which performs several tests of each function defined in "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "Vector.h"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " for each data type supported."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Two-dimensional arrays are tested in exactly the same manner.  The above description applies, but with "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "Matrix"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " substituted for "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "Vector"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ".  For three-dimensional tests, substitute "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "Tensor"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " for "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "Vector"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ".  For four-dimensional tests, substitute "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "SuperTensor"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " for "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "Vector"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ". For flat in-place array tests, substitute "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "Flat"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " for "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "Vector"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ". For the descriptions that follow, we will reference the "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "Vector"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " tests, but the same information applies to "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "Matrix"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "Tensor"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "SuperTensor"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " tests."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The command "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "make test"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " will ensure that all of the test software is built and then run all three test scripts."
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Testing organization"
        }
      ],
      "level": 1,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "Vector.h"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is a C++ header file that defines a C macro called "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "TEST_FUNC_PROTOS"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " that takes two arguments: "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "TYPE"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", which is a data type name such as "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "unsigned int"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "; and "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "SNAME"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", which is a short name for the same data type with no spaces, e.g. "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "uint"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ".  This macro defines several function prototypes that have the prefix "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "SNAME"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and have at least one argument that is an array of type "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "TYPE"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ".  Those functions that have return arguments return a "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "TYPE"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " value."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "TEST_FUNC_PROTOS"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is then implemented for all of the data types supported by "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "numpy.i"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ":"
            }
          ]
        },
        {
          "__type": "BulletList",
          "__tag": 4053,
          "ordered": false,
          "start": 1,
          "children": [
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "signed char"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "unsigned char"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "short"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "unsigned short"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "int"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "unsigned int"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "long"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "unsigned long"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "long long"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "unsigned long long"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "float"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "double"
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Testing header files"
        }
      ],
      "level": 1,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "Vector.cxx"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is a C++ source file that implements compilable code for each of the function prototypes specified in "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "Vector.h"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ".  It defines a C macro "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "TEST_FUNCS"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " that has the same arguments and works in the same way as "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "TEST_FUNC_PROTOS"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " does in "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "Vector.h"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ". "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "TEST_FUNCS"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is implemented for each of the 12 data types as above."
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Testing source files"
        }
      ],
      "level": 1,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "Vector.i"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is a "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "SWIG",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " interface file that defines python module "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "Vector"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ".  It follows the conventions for using "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "numpy.i"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " as described in this chapter.  It defines a "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "SWIG",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " macro "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "%apply_numpy_typemaps"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " that has a single argument "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "TYPE"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ". It uses the "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "SWIG",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " directive "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "%apply"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " to apply the provided typemaps to the argument signatures found in "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "Vector.h"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ".  This macro is then implemented for all of the data types supported by "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "numpy.i"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ".  It then does a "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "%include \"Vector.h\""
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " to wrap all of the function prototypes in "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "Vector.h"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " using the typemaps in "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "numpy.i"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "."
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Testing SWIG interface files"
        }
      ],
      "level": 1,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "After "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "make"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is used to build the testing extension modules, "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "testVector.py"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " can be run to execute the tests.  As with other scripts that use "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "unittest"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " to facilitate unit testing, "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "testVector.py"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " defines a class that inherits from "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "unittest.TestCase"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "      "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "class VectorTestCase(unittest.TestCase):",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "However, this class is not run directly.  Rather, it serves as a base class to several other python classes, each one specific to a particular data type.  The "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "VectorTestCase"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " class stores two strings for typing information:"
            }
          ]
        },
        {
          "__type": "DefList",
          "__tag": 4033,
          "children": [
            {
              "__type": "DefListItem",
              "__tag": 4037,
              "dt": {
                "__type": "Paragraph",
                "__tag": 4045,
                "children": [
                  {
                    "__type": "Strong",
                    "__tag": 4048,
                    "children": [
                      {
                        "__type": "Text",
                        "__tag": 4046,
                        "value": "self.typeStr"
                      }
                    ]
                  }
                ]
              },
              "dd": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "A string that matches one of the "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "SNAME"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " prefixes used in   "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "Vector.h"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "Vector.cxx"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ".  For example, "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "\"double\""
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DefListItem",
              "__tag": 4037,
              "dt": {
                "__type": "Paragraph",
                "__tag": 4045,
                "children": [
                  {
                    "__type": "Strong",
                    "__tag": 4048,
                    "children": [
                      {
                        "__type": "Text",
                        "__tag": 4046,
                        "value": "self.typeCode"
                      }
                    ]
                  }
                ]
              },
              "dd": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "A short (typically single-character) string that represents a   data type in numpy and corresponds to "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "self.typeStr"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ".  For   example, if "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "self.typeStr"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "\"double\""
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", then   "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "self.typeCode"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " should be "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "\"d\""
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Each test defined by the "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "VectorTestCase"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " class extracts the python function it is trying to test by accessing the "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "Vector"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " module's dictionary      "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "length = Vector.__dict__[self.typeStr + \"Length\"]",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "In the case of double precision tests, this will return the python function "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "Vector.doubleLength"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "We then define a new test case class for each supported data type with a short definition such as      "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "class doubleTestCase(VectorTestCase):\n    def __init__(self, methodName=\"runTest\"):\n        VectorTestCase.__init__(self, methodName)\n        self.typeStr  = \"double\"\n        self.typeCode = \"d\"",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Each of these 12 classes is collected into a "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "unittest.TestSuite"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", which is then executed.  Errors and failures are summed together and returned as the exit argument.  Any non-zero result indicates that at least one test did not pass."
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Testing Python scripts"
        }
      ],
      "level": 1,
      "target": null
    }
  ],
  "local_refs": []
}