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

feat: make ErrorType enums compare as strings #269

Merged
merged 1 commit into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/dbus_fast/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class ArgDirection(Enum):
OUT = "out"


class ErrorType(Enum):
class ErrorType(str, Enum):
"""An enum for the type of an error for a message reply.

:seealso: http://man7.org/linux/man-pages/man3/sd-bus-errors.3.html
Expand Down
8 changes: 7 additions & 1 deletion tests/test_constants.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
from dbus_fast.constants import MESSAGE_FLAG_MAP, MessageFlag
from dbus_fast.constants import MESSAGE_FLAG_MAP, ErrorType, MessageFlag
from dbus_fast.errors import DBusError


def test_message_flag_map():
assert 0 in MESSAGE_FLAG_MAP
assert MessageFlag.NONE in MESSAGE_FLAG_MAP


def test_error_type():
err = DBusError(ErrorType.FAILED, "")
assert ErrorType.FAILED == err.type
Loading