Beispiel #1
0
    def test_exception_base(self):
        """
        Test that exceptions can be caught and they have the expected message
        """

        expected_metrics = py_interop_metrics.base_error_metrics(3)
        try:
            expected_metrics.at(1)
            self.fail("index_out_of_bounds_exception should have been thrown")
        except Exception as ex:
            self.assertEqual(str(ex).split('\n')[0], "Index out of bounds")
Beispiel #2
0
    def test_index_out_of_bounds_exception(self):
        """
        Test that exceptions can be caught and they have the expected message
        TODO: flush this out for the entire model
        """

        expected_metrics = py_interop_metrics.base_error_metrics(3)
        try:
            expected_metrics.at(1)
            self.fail("index_out_of_bounds_exception should have been thrown")
        except py_interop_metrics.index_out_of_bounds_exception as ex:
            self.assertEqual(
                str(ex).split('\n')[0], "Index out of bounds - 1 >= 0")