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

Small character device verification cleanup #229

Merged

Conversation

sezanzeb
Copy link
Collaborator

@sezanzeb sezanzeb commented Jan 19, 2025

Followup for #228

Because the quick fix for the raise is still, in some way, using exceptions for control flow, and I don't like raising some exception just to replace it with a different one shortly afterwards. Also, OSError is wrong there and just happened to work for the time being. I also wanted to avoid solutions that define msg multiple times (inside the if, and inside the except), and avoid creating/formatting msg before any exception happened. So it had to be except: pass to raise the exception at the end of the method. This is somewhat hard to get beautiful and good-practice.

edit: looks pretty with assert.

Added 2 more tests.

@sezanzeb sezanzeb changed the title Refactor character device verification Cleaner character device verification Jan 19, 2025
@sezanzeb sezanzeb changed the title Cleaner character device verification Small character device verification cleanup Jan 19, 2025
@sezanzeb sezanzeb force-pushed the refactor_character_device_verification branch from e9e360e to 6d3b590 Compare January 19, 2025 11:42
@sezanzeb sezanzeb merged commit 83f9360 into gvalkov:main Jan 21, 2025
7 checks passed
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 this pull request may close these issues.

1 participant