def test_edge_cases_visualization_subplot(self):
        """`visualization.Visualization.subplot`: Edge Case Validator.

        Tests the behavior of `Visualization.subplot` with edge cases.

        Raises:
            Exception: If at least one `Exception` raised is not of the expected
                kind.

        """
        x = _compose(list, _np.random.uniform)(0.0,
                                               100.0,
                                               size=self.data_shape[0])
        """list of float: Random x-values."""
        values = {
            name: _compose(list, _np.random.uniform)(0.0, 100.0,
                                                     size=self.data_shape[0]) \
                  for name in ["observations", "predictions"]
        }
        """:obj:`list of float`: Contains all y-values."""

        v = Visualization("Title", (1, 1))
        """Visualization: Plotter instance."""

        for ModelWrapper in self.wrappers.values():
            with self.assertRaises(IndexError):
                # Suplot index out of range.
                v._subplot(1, x, values)

            with self.assertRaises(TypeError):
                # Empty `x`-values.
                v._subplot([], values, 0)

            with self.assertRaises(TypeError):
                # Empty `y`-values.
                v._subplot(x, {}, 0)

        v.close()
    def test_invalid_args_visualization_subplot(self):
        """`visualization.Visualization.subplot`: Argument Validator.

        Tests the behavior of `Visualization.subplot` with invalid
        argument counts and values.

        Raises:
            Exception: If at least one `Exception` raised is not of the expected
                kind.

        """
        x = _compose(list, _np.random.uniform)(0.0,
                                               100.0,
                                               size=self.data_shape[0])
        """list of float: Random x-values."""
        values = {
            name: _compose(list, _np.random.uniform)(0.0, 100.0,
                                                     size=self.data_shape[0]) \
                  for name in ["observations", "predictions"]
        }
        """:obj:`list of float`: Contains all y-values."""

        v = Visualization("Title", (1, 1))
        """Visualization: Plotter instance."""

        with self.assertRaises(TypeError):
            # No arguments.
            v._subplot()

        with self.assertRaises(TypeError):
            # Only one argument.
            v._subplot(x)

        with self.assertRaises(TypeError):
            # Only two arguments.
            v._subplot(x, values)

        with self.assertRaises(TypeError):
            # Too many arguments.
            v._subplot(x, values, 0, "Title", "X-label", "Y-label", True,
                       "extra")

        with self.assertRaises(TypeError):
            # Invalid keyword.
            v._subplot(x, values, 0, key="value")

        with self.assertRaises(TypeError):
            # `None` instead of list `x`.
            v._subplot(None, values, 0)

        with self.assertRaises(TypeError):
            # np.matrix instead of list `x`.
            v._subplot(_np.matrix(x), values, 0)

        with self.assertRaises(TypeError):
            # `None` instead of dict of lists `values`.
            v._subplot(x, None, 0)

        with self.assertRaises(TypeError):
            value_list = {k: _np.matrix(val) for k, val in values.iteritems()}
            """:obj:`np.matrix`: Lists in `values` mapped to matrices."""

            # Dict of np.matrix instead of dict of lists `values`.
            v._subplot(x, value_list, 0)

        with self.assertRaises(TypeError):
            # List instead of dict of lists `values`.
            v._subplot(x, x, 0)

        with self.assertRaises(TypeError):
            # Incompatible x- and y-values.
            values_hat = {
                name: _compose(list, _np.random.uniform)(0.0, 100.0,
                                                         size=self.data_shape[1]) \
                      for name in ["observations", "predictions"]
            }
            """:obj:`list of float`: Contains all y-values."""
            v._subplot(x, values, 0)

        with self.assertRaises(TypeError):
            # `None` instead of int `subplot`.
            v._subplot(x, values, None)

        with self.assertRaises(TypeError):
            # Float instead of int `subplot`.
            v._subplot(x, values, 5.6)

        with self.assertRaises(TypeError):
            # Non-string `title`.
            v._subplot(x, values, 0, title=["hello", "bye"])

        with self.assertRaises(TypeError):
            # Non-string `xlabel`.
            v._subplot(x, values, 0, xlabel=["hello", "bye"])

        with self.assertRaises(TypeError):
            # Non-string `ylabel`.
            v._subplot(x, values, 0, ylabel=["hello", "bye"])