def test_theoretical_output(self):
        """
        proper_value is calculated using R function infotheo::entropy(method="emp")
        """
        input_1 = [9, 8, 7, 6, 5, 4, 3, 2, 9]
        proper_value_1 = 2.043192
        self.assertAlmostEqual(entropy(input_1), proper_value_1, places=3)

        input_2 = [0, 0, 0, 0, 1, 0, 0, 0, 0]
        proper_value_2 = 0.3488321
        self.assertAlmostEqual(entropy(input_2), proper_value_2, places=3)

        # Entropy must be higher in more diverse vectors
        self.assertGreater(entropy(input_1), entropy(input_2))
 def test_empty_input(self):
     input = []
     with self.assertRaises(AssertionError):
         entropy(input)
 def test_nparray_input(self):
     np_input = np.array([1, 2, 3, 5, 432, 42, 31234, 342, 34])
     self.assertIsInstance(entropy(np_input), float)
 def test_list_input(self):
     list_input = [1, 2, 3, 5, 432, 42, 31234, 342, 34]
     self.assertIsInstance(entropy(list_input), float)
    def test_the_same_vectors(self):
        input_1 = [9, 8, 7, 6, 5, 4, 3, 2, 9]
        input_2 = [9, 8, 7, 6, 5, 4, 3, 2, 9]

        self.assertEqual(mutual_information(input_1, input_2),
                         entropy(input_1))
 def test_one_number_input(self):
     self.assertEqual(entropy([1]), 0.0)