Skip to content
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 ring/func/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def coerce_function(t):
if issubclass(t, (list, tuple)):
return _coerce_list_and_tuple

if t is type:
if t is type or t is abc.ABCMeta:
return _coerce_type

if issubclass(t, dict):
Expand Down
7 changes: 7 additions & 0 deletions tests/test_coerce.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import abc
import sys

import pytest
Expand Down Expand Up @@ -37,6 +38,10 @@ def __str__(self):
return str(self.user_id)


class ABCUser(abc.ABC):
pass


ring_key_instance = User(42)
ring_hash_instance = HashUser(42)
test_parameters = [
Expand All @@ -49,6 +54,8 @@ def __str__(self):
({1, 2, 3, 4}, "{1,2,3,4}"),
({"1", "2", "3", "4"}, "{'1','2','3','4'}"),
(("1", "2", "3", "4"), "('1','2','3','4')"),
(User, "User"),
(ABCUser, "ABCUser"),
]
if numpy is not None:
test_parameters.extend(
Expand Down