CI/DOC: Fixing bug in validate_docstrings.py
Follow up of #23514. One of the validation error wasn't tested, and with the refactoring a typo was introduced, where a bracket closed in the wrong place, raised a KeyError when a private class was found in a docstrings (and adding test for that case

- [X] tests added / passed
- [X] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry

Hello @datapythonista! Thanks for submitting the PR.

 - There are no PEP8 issues in the file [`scripts/tests/test_validate_docstrings.py`](https://github.com/datapythonista/pandas/blob/969feeb627e60c1f7993ba2acf8785f44d80f092/scripts/tests/test_validate_docstrings.py) !

 - There are no PEP8 issues in the file [`scripts/validate_docstrings.py`](https://github.com/datapythonista/pandas/blob/969feeb627e60c1f7993ba2acf8785f44d80f092/scripts/validate_docstrings.py) !

 # [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/23543?src=pr&el=h1) Report
> Merging [#23543](https://codecov.io/gh/pandas-dev/pandas/pull/23543?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/5938ce1ddd7106a83b9278a7e9d021d567bb85ac?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/23543/graphs/tree.svg?width=650&token=eZ4WkYLtcO&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/23543?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master   #23543   +/-   ##
=======================================
  Coverage   92.25%   92.25%           
=======================================
  Files         161      161           
  Lines       51207    51207           
=======================================
  Hits        47239    47239           
  Misses       3968     3968
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.63% <ø> (ø)` | :arrow_up: |
| #single | `42.28% <ø> (ø)` | :arrow_up: |


------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/23543?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/23543?src=pr&el=footer). Last update [5938ce1...969feeb](https://codecov.io/gh/pandas-dev/pandas/pull/23543?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
