Skip to content

Commit

Permalink
cover collections att getter by tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lesnik512 committed Oct 3, 2024
1 parent 630733a commit 679c179
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/providers/test_collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from tests.container import create_async_resource, create_sync_resource
from that_depends import BaseContainer, providers
from that_depends.providers import AbstractProvider


class DIContainer(BaseContainer):
Expand Down Expand Up @@ -46,3 +47,9 @@ async def test_dict_provider() -> None:

assert mapping == {"sync_resource": sync_resource, "async_resource": async_resource}
assert mapping == DIContainer.mapping.sync_resolve()


@pytest.mark.parametrize("provider", [DIContainer.sequence, DIContainer.mapping])
async def test_attr_getter_in_collections_providers(provider: AbstractProvider[typing.Any]) -> None:
with pytest.raises(AttributeError, match=f"'{type(provider)}' object has no attribute 'some_attribute'"):
await provider.some_attribute

0 comments on commit 679c179

Please sign in to comment.