TST Providing unit test to snippet GH32414
- [x] closes #32414

A unit test has been added to check the validity of pd.Categorical() . This PR is with respect to the GitHub issue no. 32414.
Thanks


Hello @Bhavay192! Thanks for opening this PR. We checked the lines you've touched for [PEP 8](https://www.python.org/dev/peps/pep-0008) issues, and found:

* In the file [`pandas/tests/test_categorical.py`](https://github.com/pandas-dev/pandas/blob/63c85da81fe9109f61a0d569771e52951bfe636c/pandas/tests/test_categorical.py):

> [Line 4:1](https://github.com/pandas-dev/pandas/blob/63c85da81fe9109f61a0d569771e52951bfe636c/pandas/tests/test_categorical.py#L4): [E302](https://duckduckgo.com/?q=pep8%20E302) expected 2 blank lines, found 1
> [Line 5:3](https://github.com/pandas-dev/pandas/blob/63c85da81fe9109f61a0d569771e52951bfe636c/pandas/tests/test_categorical.py#L5): [E111](https://duckduckgo.com/?q=pep8%20E111) indentation is not a multiple of four
> [Line 6:7](https://github.com/pandas-dev/pandas/blob/63c85da81fe9109f61a0d569771e52951bfe636c/pandas/tests/test_categorical.py#L6): [E111](https://duckduckgo.com/?q=pep8%20E111) indentation is not a multiple of four
> [Line 6:89](https://github.com/pandas-dev/pandas/blob/63c85da81fe9109f61a0d569771e52951bfe636c/pandas/tests/test_categorical.py#L6): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (108 > 88 characters)
> [Line 7:3](https://github.com/pandas-dev/pandas/blob/63c85da81fe9109f61a0d569771e52951bfe636c/pandas/tests/test_categorical.py#L7): [E111](https://duckduckgo.com/?q=pep8%20E111) indentation is not a multiple of four
> [Line 9:3](https://github.com/pandas-dev/pandas/blob/63c85da81fe9109f61a0d569771e52951bfe636c/pandas/tests/test_categorical.py#L9): [E111](https://duckduckgo.com/?q=pep8%20E111) indentation is not a multiple of four
> [Line 10:3](https://github.com/pandas-dev/pandas/blob/63c85da81fe9109f61a0d569771e52951bfe636c/pandas/tests/test_categorical.py#L10): [E111](https://duckduckgo.com/?q=pep8%20E111) indentation is not a multiple of four
> [Line 11:3](https://github.com/pandas-dev/pandas/blob/63c85da81fe9109f61a0d569771e52951bfe636c/pandas/tests/test_categorical.py#L11): [E111](https://duckduckgo.com/?q=pep8%20E111) indentation is not a multiple of four
> [Line 13:1](https://github.com/pandas-dev/pandas/blob/63c85da81fe9109f61a0d569771e52951bfe636c/pandas/tests/test_categorical.py#L13): [E302](https://duckduckgo.com/?q=pep8%20E302) expected 2 blank lines, found 1
> [Line 14:1](https://github.com/pandas-dev/pandas/blob/63c85da81fe9109f61a0d569771e52951bfe636c/pandas/tests/test_categorical.py#L14): [W293](https://duckduckgo.com/?q=pep8%20W293) blank line contains whitespace
> [Line 15:3](https://github.com/pandas-dev/pandas/blob/63c85da81fe9109f61a0d569771e52951bfe636c/pandas/tests/test_categorical.py#L15): [E111](https://duckduckgo.com/?q=pep8%20E111) indentation is not a multiple of four
> [Line 16:89](https://github.com/pandas-dev/pandas/blob/63c85da81fe9109f61a0d569771e52951bfe636c/pandas/tests/test_categorical.py#L16): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (94 > 88 characters)
> [Line 17:89](https://github.com/pandas-dev/pandas/blob/63c85da81fe9109f61a0d569771e52951bfe636c/pandas/tests/test_categorical.py#L17): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (104 > 88 characters)
> [Line 19:3](https://github.com/pandas-dev/pandas/blob/63c85da81fe9109f61a0d569771e52951bfe636c/pandas/tests/test_categorical.py#L19): [E111](https://duckduckgo.com/?q=pep8%20E111) indentation is not a multiple of four
> [Line 22:1](https://github.com/pandas-dev/pandas/blob/63c85da81fe9109f61a0d569771e52951bfe636c/pandas/tests/test_categorical.py#L22): [E305](https://duckduckgo.com/?q=pep8%20E305) expected 2 blank lines after class or function definition, found 1
> [Line 22:24](https://github.com/pandas-dev/pandas/blob/63c85da81fe9109f61a0d569771e52951bfe636c/pandas/tests/test_categorical.py#L22): [E231](https://duckduckgo.com/?q=pep8%20E231) missing whitespace after ','
> [Line 22:49](https://github.com/pandas-dev/pandas/blob/63c85da81fe9109f61a0d569771e52951bfe636c/pandas/tests/test_categorical.py#L22): [W292](https://duckduckgo.com/?q=pep8%20W292) no newline at end of file

 hey @mroeschke , thanks for taking the time to preview my pull request and responding. As per your comment, should I just add my code under the given file, or do I need to add any further checks ?? You would just need to put this test in that file I mentioned and format the test like the others in that file hey @mroeschke , thanks for replying. I just added the that test to the file you mentioned. As my PR gets reviewed, my tests seems to be broken as it is not passing the ci test and also has an liniting error. Could you help me with that please. Thanks Please review the entirety of this page for how to make a pull request: https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html hey @mroeschke, I have made a pull request and have added my test into the folder you specified. But I mistakenly made a new pull request and there are some warnings in that. I request you to please help me in that PR. PR no. is 43230 Okay will close this in favor of that PR: https://github.com/pandas-dev/pandas/pull/43230 Yaa thanks and please help me with that