Esempio 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')
Esempio 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')
Esempio 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'")
Esempio 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)
Esempio 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)