TST: Inconsistent behavior of .replace() in Int64 series with NA 
- [ ] closes #38267
- [ ] tests added / passed
- [ ] passes `black pandas`
- [ ] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry

thank you for your review

<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Virus-free.
www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Sat, Dec 26, 2020 at 1:09 AM Marco Gorelli <notifications@github.com>
wrote:

> *@MarcoGorelli* requested changes on this pull request.
>
> Thanks @ftrihardjo <https://github.com/ftrihardjo>
> ------------------------------
>
> In pandas/tests/series/methods/test_replace.py
> <https://github.com/pandas-dev/pandas/pull/38693#discussion_r548898329>:
>
> > +    def test_replace_int_with_na(self, dtype):
> +        result = pd.Series([0, None]).astype(dtype)
>
> can you put the issue number as a comment here? see some other tests for
> an example
> ------------------------------
>
> In pandas/tests/series/methods/test_replace.py
> <https://github.com/pandas-dev/pandas/pull/38693#discussion_r548898449>:
>
> > @@ -208,6 +208,14 @@ def test_replace_with_dict_with_bool_keys(self):
>          expected = pd.Series(["yes", False, "yes"])
>          tm.assert_series_equal(result, expected)
>
> +    @pytest.mark.parametrize('dtype', ['int8', 'int16', 'int32', 'int64'])
> +    def test_replace_int_with_na(self, dtype):
> +        result = pd.Series([0, None]).astype(dtype)
> +        result.replace(0, pd.NA)
>
> I think you'll want
>
> result = result.replace(0, pd.NA)
>
> ------------------------------
>
> In pandas/tests/series/methods/test_replace.py
> <https://github.com/pandas-dev/pandas/pull/38693#discussion_r548898461>:
>
> > @@ -208,6 +208,14 @@ def test_replace_with_dict_with_bool_keys(self):
>          expected = pd.Series(["yes", False, "yes"])
>          tm.assert_series_equal(result, expected)
>
> +    @pytest.mark.parametrize('dtype', ['int8', 'int16', 'int32', 'int64'])
> +    def test_replace_int_with_na(self, dtype):
> +        result = pd.Series([0, None]).astype(dtype)
> +        result.replace(0, pd.NA)
> +        expected = pd.Series([0, None]).astype(dtype)
> +        expected.fillna(0).replace(0, pd.NA)
>
> why is this line needed? Just construct expected directly
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <https://github.com/pandas-dev/pandas/pull/38693#pullrequestreview-558831366>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AF2RQQOYKEZAMDBFVPBC7UDSWTILXANCNFSM4VI6XQWA>
> .
>
 Thanks @ftrihardjo , looks like just https://github.com/pandas-dev/pandas/pull/38693#discussion_r549074576 still needs to be addressed Hello @ftrihardjo! Thanks for updating this PR. We checked the lines you've touched for [PEP 8](https://www.python.org/dev/peps/pep-0008) issues, and found:



There are currently no PEP 8 issues detected in this Pull Request. Cheers! :beers: 

##### Comment last updated at 2020-12-28 02:00:00 UTC thanks @ftrihardjo 