def test_r_square_random_arrays_finite_values(self, y_true, y_pred):
        r_square_value = r_square(y_true, y_pred)
        expected_r_square = self._correct_r_squared(y_true, y_pred)
        print(y_true)
        print(y_pred)

        assert expected_r_square == r_square_value
    def test_r_square_dataframe(self):
        y_true = pd.DataFrame([0, 1, 2, 3, 4, 5])
        y_pred = pd.DataFrame([-1, 4, 5, 10, 4, 1])

        r_square_value = np.round(r_square(y_true, y_pred), decimals=2)
        expected_r_square = -3.8

        assert expected_r_square == r_square_value
    def test_r_square_array(self):
        y_true = np.array([0, 1, 2, 3, 4, 5])
        y_pred = np.array([-1, 4, 5, 10, 4, 1])

        r_square_value = np.round(r_square(y_true, y_pred), decimals=2)
        expected_r_square = -3.8

        assert expected_r_square == r_square_value
    def test_r_square_list(self):
        y_true = [0, 1, 2, 3, 4, 5]
        y_pred = [-1, 4, 5, 10, 4, 1]

        r_square_value = np.round(r_square(y_true, y_pred), decimals=2)
        expected_r_square = -3.8

        assert expected_r_square == r_square_value
    def test_r_square_ss_tot_zero(self):
        # The test checks for 'if' condition
        # to check if ss_res is certain value and ss_tot are all Zeros
        y_true = np.array([0, 0, 0, 0, 0, 0])
        y_pred = np.array([1, 1, 1, 1, 1, 1])

        r_square_value = np.round(r_square(y_true, y_pred), decimals=2)
        expected_r_square = 0.0

        assert expected_r_square == r_square_value
    def test_r_square_all_zero_values(self):
        # The test checks for all zero inputs covering the 'if' condition
        # to check if both ss_res and ss_tot are all Zeros
        y_true = np.array([0, 0, 0, 0, 0, 0])
        y_pred = np.array([0, 0, 0, 0, 0, 0])

        r_square_value = np.round(r_square(y_true, y_pred), decimals=2)
        expected_r_square = 1.0

        assert expected_r_square == r_square_value
    def test_r_square_ss_res_ss_tot_infinity(self):
        # The test checks for 'if' condition
        # to check if both ss_res and ss_tot are Infinite
        y_true = [
            0.00000000e000,
            0.00000000e000,
            9.81351055e200,
            9.81351055e200,
            9.81351055e200,
            9.81351055e200,
            9.81351055e200,
            9.81351055e200,
            9.81351055e200,
            9.81351055e200,
            9.81351055e200,
            9.81351055e200,
            9.81351055e200,
            9.81351055e200,
            9.81351055e200,
            9.81351055e200,
            9.81351055e200,
            9.81351055e200,
            9.81351055e200,
            9.81351055e200,
            9.81351055e200,
            9.81351055e200,
            9.81351055e200,
            9.81351055e200,
            9.81351055e200,
            9.81351055e200,
            9.81351055e200,
            9.81351055e200,
            9.81351055e200,
            9.81351055e200,
        ]
        y_pred = [
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
            0.0,
        ]

        r_square_value = np.round(r_square(y_true, y_pred), decimals=2)
        expected_r_square = np.NINF

        assert expected_r_square == r_square_value
    def test_infinite_values(self):
        y_true = np.random.random(4)
        y_pred = [0, np.inf, 2, 3]

        with pytest.raises(ValueError):
            r_square(y_true, y_pred)
    def test_nan_values(self):
        y_true = [np.nan, 1, 2, 3]
        y_pred = np.random.random(4)

        with pytest.raises(ValueError):
            r_square(y_true, y_pred)
    def test_wrong_vector_length(self):
        y_true = np.random.random(5)
        y_pred = np.random.random(4)

        with pytest.raises(ValueError):
            r_square(y_true, y_pred)