Exemplo n.º 1
0
 def test_corr_negative_elements(self):
     """
     Negative unittest for wrong input.
     :returns: None; AssertionError -- if test fails
     """
     with self.assertRaises(TypeError) as raised_exception:
         correlation(['aaa', 2], [2, 3])
     self.assertEqual(raised_exception.exception.args[0],
                      'elements of object should be int or float values')
Exemplo n.º 2
0
 def test_corr_negative_type(self):
     """
     Negative unittest for wrong input.
     :returns: None; AssertionError -- if test fails
     """
     with self.assertRaises(TypeError) as raised_exception:
         correlation(2, 3)
     self.assertEqual(raised_exception.exception.args[0],
                      'object should be iterable')
Exemplo n.º 3
0
 def test_corr_missing_elements(self):
     """
     Negative unittest for wrong input.
     :returns: None; AssertionError -- if test fails
     """
     with self.assertRaises(TypeError) as raised_exception:
         correlation([2, 3])
     self.assertEqual(
         raised_exception.exception.args[0],
         "correlation() missing 1 required positional argument: 'y'")
Exemplo n.º 4
0
 def test_corr_positive_type(self):
     """
     Positive unittest for type correctness of result.
     :returns: None; AssertionError -- if test fails
     """
     x = correlation([1, 2, 3], [1, 2, 3])
     self.assertIsInstance(x, float)
Exemplo n.º 5
0
 def test_corr_positive_zero(self):
     """
     Positive unittest for correctness of function.
     Checks if function returns correct result.
     :returns: None; AssertionError -- if test fails
     """
     x = correlation([1, 1, 1], [1, 1, 1])
     self.assertEqual(x, 0)