Skip to content

Commit

Permalink
Added extended registry meta test
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianPugh committed Apr 12, 2023
1 parent 1258bd2 commit ee74b22
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/test_meta_extension.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from autoregistry import RegistryMeta


class ExtendedRegistryMeta(RegistryMeta):
def __call__(cls, *args, **kwargs): # noqa: N805
out = super().__call__(*args, **kwargs)
out.extended_attribute = cls.__name__
return out


class Foo(metaclass=ExtendedRegistryMeta):
pass


class Bar(Foo):
pass


def test_extended_registry():
foo = Foo()
bar = Bar()

assert foo.extended_attribute == "Foo"
assert bar.extended_attribute == "Bar"

assert list(Foo) == ["bar"]

0 comments on commit ee74b22

Please sign in to comment.