Skip to content

Commit

Permalink
Fixing a minor bug in a test (#8223)
Browse files Browse the repository at this point in the history
### Description

There is a minor bug in a test which causes a second fail to occur when
one does. In `test_module_list.py`, there is a list of classes to check
which must have aliases removed from it. This must be done before the
test assert so that in the event the assert fails this removal isn't
skipped.

### Types of changes
<!--- Put an `x` in all the boxes that apply, and remove the not
applicable items -->
- [x] Non-breaking change (fix or new feature that would not break
existing functionality).
- [ ] Breaking change (fix or new feature that would cause existing
functionality to change).
- [ ] New tests added to cover the changes.
- [ ] Integration tests passed locally by running `./runtests.sh -f -u
--net --coverage`.
- [ ] Quick tests passed locally by running `./runtests.sh --quick
--unittests --disttests`.
- [ ] In-line docstrings updated.
- [ ] Documentation updated, tested `make html` command in the `docs/`
folder.

---------

Signed-off-by: Eric Kerfoot <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
ericspod and pre-commit-ci[bot] authored Nov 21, 2024
1 parent 13b96ae commit b1e915c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tests/test_module_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,17 @@ def test_transform_api(self):
continue
with self.subTest(n=n):
basename = n[:-1] # Transformd basename is Transform

# remove aliases to check, do this before the assert below so that a failed assert does skip this
for postfix in ("D", "d", "Dict"):
remained.remove(f"{basename}{postfix}")

for docname in (f"{basename}", f"{basename}d"):
if docname in to_exclude_docs:
continue
if (contents is not None) and f"`{docname}`" not in f"{contents}":
self.assertTrue(False, f"please add `{docname}` to docs/source/transforms.rst")
for postfix in ("D", "d", "Dict"):
remained.remove(f"{basename}{postfix}")

self.assertFalse(remained)


Expand Down

0 comments on commit b1e915c

Please sign in to comment.