Skip to content

Commit

Permalink
fixed passing configs into explicitly invoked Registry.
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianPugh committed May 18, 2022
1 parent 7e0922c commit 45b6f84
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion autoregistry/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class Registry(metaclass=RegistryMeta):
def __new__(cls, *args, **kwargs):
if cls is Registry:
# A Registry is being explicitly created for decorating
return super().__new__(RegistryDecorator, *args, **kwargs)
return super().__new__(RegistryDecorator)
else:
# Registry is being subclassed
return super().__new__(cls)
Expand Down
16 changes: 16 additions & 0 deletions tests/test_functions_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import pytest

from autoregistry import Registry


def test_decorator_case_sensitive():
registry = Registry(case_sensitive=True)

@registry
def foo():
pass

assert list(registry) == ["foo"]

with pytest.raises(KeyError):
registry["FOO"]

0 comments on commit 45b6f84

Please sign in to comment.