예제 #1
0
    def test_fast_mean_iterated_with_values(self):
        # Arrange
        values1 = np.asarray([0.0, 1.1, 2.2], dtype=np.float64)
        values2 = np.asarray([0.0, 1.1, 2.2, 3.3, 4.4], dtype=np.float64)

        # Act
        result1 = fast_mean_iterated(values1, 0.0, fast_mean(values1), 5)
        result2 = fast_mean_iterated(values2, 5.5, np.mean(values2), 5)

        # Assert
        assert result1 == np.mean([0.0, 1.1, 2.2])
        assert result2 == 3.3000000000000003
    def test_fast_mean_iterated_with_values(self):
        # Arrange
        values1 = [0.0, 1.1, 2.2]
        values2 = [0.0, 1.1, 2.2, 3.3, 4.4]

        # Act
        result1 = fast_mean_iterated(values1, 0.0, fast_mean(values1), 5)
        result2 = fast_mean_iterated(values2, 5.5, np.mean(values2), 5)

        # Assert
        self.assertEqual(np.mean([0.0, 1.1, 2.2]), result1)
        self.assertAlmostEqual(3.3, result2)
예제 #3
0
    def test_fast_mean_iterated_with_values(self):
        # Arrange
        values1 = [0.0, 1.1, 2.2]
        values2 = [0.0, 1.1, 2.2, 3.3, 4.4]

        # Act
        result1 = fast_mean_iterated(values1, 0.0, fast_mean(values1), 5)
        result2 = fast_mean_iterated(values2, 5.5, np.mean(values2), 5)

        # Assert
        assert np.mean([0.0, 1.1, 2.2]) == result1
        assert 3.3000000000000003 == result2
예제 #4
0
    def test_fast_mean_iterated_with_empty_list_returns_zero(self):
        # Arrange
        values = np.asarray([], dtype=np.float64)

        # Act
        result = fast_mean_iterated(values, 0.0, 0.0, 6)

        # Assert
        assert result == 0
    def test_fast_mean_iterated_with_empty_list_returns_zero(self):
        # Arrange
        values = []

        # Act
        result = fast_mean_iterated(values, 0.0, 0.0, 6)

        # Assert
        self.assertEqual(0, result)