# Path: pycast/errors/meansignedpercentageerror.py
# class MeanSignedPercentageError(MeanAbsolutePercentageError):
# 
#     """An over/under estimation aware percentage error."""
# 
#     def local_error(self, originalValue, calculatedValue):
#         """Calculates the error between the two given values.
# 
#         :param list originalValue:    List containing the values of the original data.
#         :param list calculatedValue:    List containing the values of the calculated TimeSeries that
#             corresponds to originalValue.
# 
#         :return:    Returns the error measure of the two given values.
#         :rtype:     numeric
#         """
# 
#         return (float(calculatedValue[0] - originalValue[0])/originalValue[0])*100 if originalValue[0] else None


import unittest
from pycast.errors.meansignedpercentageerror import MeanSignedPercentageError
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

# required external modules

# required modules from pycast

class MeanSignedPercentageErrorTest(unittest.TestCase):

    """Test class containing all tests for MeanSignedPercentageError."""


    def setUp(self):
        self.dataOrg = [1.0,    2.3,    0.1,    -2.0,   -1.0,   0.0,    -0.2,   -0.3,   0.15,   -0.2,   0]
        self.dataCalc = [1.2,   2.0,    -0.3,   -1.5,   -1.5,   0.3,    0.0,    0.3,    -0.15,  0.3,   0]

    def tearDown(self):
        pass

    def local_error_test(self):
        """Test MeanSignedPercentageError.local_error."""
        localErrors = [20,  -13.043, -400,  -25, 50,    None,  -100,  -200,  -200,  -250, None]


# Path: pycast/errors/meansignedpercentageerror.py
# class MeanSignedPercentageError(MeanAbsolutePercentageError):
# 
#     """An over/under estimation aware percentage error."""
# 
#     def local_error(self, originalValue, calculatedValue):
#         """Calculates the error between the two given values.
# 
#         :param list originalValue:    List containing the values of the original data.
#         :param list calculatedValue:    List containing the values of the calculated TimeSeries that
#             corresponds to originalValue.
# 
#         :return:    Returns the error measure of the two given values.
#         :rtype:     numeric
#         """
# 
#         return (float(calculatedValue[0] - originalValue[0])/originalValue[0])*100 if originalValue[0] else None


# Path: pycast/tests/meansignedpercentageerrortest.py
import unittest
from pycast.errors.meansignedpercentageerror import MeanSignedPercentageError

# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

# required external modules

# required modules from pycast

class MeanSignedPercentageErrorTest(unittest.TestCase):

    """Test class containing all tests for MeanSignedPercentageError."""


    def setUp(self):
        self.dataOrg = [1.0,    2.3,    0.1,    -2.0,   -1.0,   0.0,    -0.2,   -0.3,   0.15,   -0.2,   0]
        self.dataCalc = [1.2,   2.0,    -0.3,   -1.5,   -1.5,   0.3,    0.0,    0.3,    -0.15,  0.3,   0]

    def tearDown(self):
        pass

    def local_error_test(self):
        """Test MeanSignedPercentageError.local_error."""
        localErrors = [20,  -13.043, -400,  -25, 50,    None,  -100,  -200,  -200,  -250, None]


        mpe = MeanSignedPercentageError()