Add test case for applying a function to a groupby object that append…
…s each group to a list without using copy() function. The test checks if the groups are correctly appended to the list. This resolves GH issue 17718.

- [ ] closes #17718 (Replace xxxx with the GitHub issue number)
- [ ] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [ ] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [ ] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [ ] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.

> Hi,
> Some checks are failing because of the formatting of the code.
> here is the [documentation](https://pandas.pydata.org/docs/dev/development/contributing_codebase.html#contributing-pre-commit) for `pre-commit`.
> Could you install it and then commit again?

OK, thank you :) Thanks @idor980 