Repository: pandas-dev/pandas
File: pandas/tests/series/methods/test_round.py (Python)

Code before:
        expected_rounded = Series(
            [1.12, 2.12, 3.12], index=range(3), dtype=any_float_dtype
        )
        result = round(ser, decimals)
        tm.assert_series_equal(result, expected_rounded)

    @pytest.mark.parametrize("method", ["round", "floor", "ceil"])
    @pytest.mark.parametrize("freq", ["s", "5s", "min", "5min", "h", "5h"])
    # GH14940, GH#56158
    def test_round_nat(self, method, freq, unit):
        ser = Series([pd.NaT], dtype=f"M8[{unit}]")
        expected = Series(pd.NaT, dtype=f"M8[{unit}]")
        round_method = getattr(ser.dt, method)
        result = round_method(freq)
        tm.assert_series_equal(result, expected)

    def test_round_ea_boolean(self):
        ser = Series([True, False], dtype="boolean")
        expected = ser.copy()
        result = ser.round(2)
        tm.assert_series_equal(result, expected)
        result.iloc[0] = False
        tm.assert_series_equal(ser, expected)


class TestRound:
    @pytest.mark.parametrize(
        "data,decimals,expected_data",
        [
            ([0.2], 0, [0.0]),
            ([1.234, 2.567], 1, [1.2, 2.6]),
            ([1.234, 2.567], 2, [1.23, 2.57]),
            ([1.234, 2.567], 0, [1.0, 3.0]),
        ],
    )
    def test_round_dtype_object(self, data, decimals, expected_data):
        # GH#63444
        ser = Series(data, dtype="object")
        result = ser.round(decimals)
        expected = Series(expected_data, dtype="object")
        tm.assert_series_equal(result, expected)

    @pytest.mark.parametrize(
        "dtype",
        [
            None,
            "float64",
            "int64",
        ],
    )
    def test_round_empty_series(self, dtype):

Review comment (suggestion):
This is introducing `TestRound` when there is already `TestSeriesRound` in this file. I see nothing that differentiates these two. If that is indeed the case, please combine them as `TestSeriesRound`.

Code after:
        expected_rounded = Series(
            [1.12, 2.12, 3.12], index=range(3), dtype=any_float_dtype
        )
        result = round(ser, decimals)
        tm.assert_series_equal(result, expected_rounded)

    @pytest.mark.parametrize("method", ["round", "floor", "ceil"])
    @pytest.mark.parametrize("freq", ["s", "5s", "min", "5min", "h", "5h"])
    def test_round_nat(self, method, freq, unit):
        # GH14940, GH#56158
        ser = Series([pd.NaT], dtype=f"M8[{unit}]")
        expected = Series(pd.NaT, dtype=f"M8[{unit}]")
        round_method = getattr(ser.dt, method)
        result = round_method(freq)
        tm.assert_series_equal(result, expected)

    def test_round_ea_boolean(self):
        # GH#55936
        ser = Series([True, False], dtype="boolean")
        expected = ser.copy()
        result = ser.round(2)
        tm.assert_series_equal(result, expected)
        result.iloc[0] = False
        tm.assert_series_equal(ser, expected)

    @pytest.mark.parametrize(
        "data,decimals,expected_data",
        [
            ([0.2], 0, [0.0]),
            ([1.234, 2.567], 1, [1.2, 2.6]),
            ([1.234, 2.567], 2, [1.23, 2.57]),
            ([1.234, 2.567], 0, [1.0, 3.0]),
        ],
    )
    def test_round_dtype_object(self, data, decimals, expected_data):
        # GH#63444
        ser = Series(data, dtype="object")
        result = ser.round(decimals)
        expected = Series(expected_data, dtype="object")
        tm.assert_series_equal(result, expected)

    @pytest.mark.parametrize(
        "dtype",
        [
            None,
            "float64",
            "int64",
            "object",
        ],
    )
    def test_round_empty_series(self, dtype):