Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix type checkings to isinstance #120

Closed
lsetiawan opened this issue Aug 1, 2023 · 1 comment · Fixed by #115
Closed

Fix type checkings to isinstance #120

lsetiawan opened this issue Aug 1, 2023 · 1 comment · Fixed by #115
Assignees

Comments

@lsetiawan
Copy link
Member

lsetiawan commented Aug 1, 2023

Overview

There are pieces of the code that does type comparison using type(blah) == mytype. This now seem to fail during pre-commit.ci as seen in PR #119. The better solution when comparing type, use isinstance(blah, mytype).

Places with errors

if type(region_ids) == list:
if len(region_ids) == 0:
raise ValueError("region_ids is empty. Cannot be empty.")
else:
raise TypeError(
f"region_ids must be of type list. Currently is of type {type(region_ids)}"
)

# convert a single file output to a list of one element
if type(select_Sv_files) == str:
select_Sv_files = [select_Sv_files]
# convert a single file output to a list of one element
if type(select_raw_files) == str:
select_raw_files = [select_raw_files]

@ctuguinay
Copy link
Collaborator

Thanks for spotting this! @lsetiawan, will add this to my testing PR.

@ctuguinay ctuguinay linked a pull request Aug 2, 2023 that will close this issue
ctuguinay added a commit that referenced this issue Aug 2, 2023
## Improve Testing

This PR closes #58, #107, #85, #112, #113, #99, #53, #28, #120:

- Created and used a new testing suite: New EVL, new EVR, new Zarr file
- New testing suite resolved the warning that arose from #85
- Refactored tests
- Added fixtures
- Added hints
- Added marks
- Added/improved upon numpy docstrings for tests and fixtures
- Added further tests for Lines and Regions2D
- Added functionality and tests for EVR parser to handle missing bbox values and no regions
- Removed the unused convert_points function
- Fixes docstrings that appeared as errors in the readthedocs
- Used Pathlib instead of OS

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants