Skip to content

Commit

Permalink
Remove unused test, add missing assert
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan committed Oct 27, 2024
1 parent 094fec7 commit b41f880
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
1 change: 1 addition & 0 deletions tests/integration/test_fastapi/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
router = APIRouter(prefix="/api")

RedisDependency = Annotated[Redis, Depends(Provide[Container.redis])]
RedisDependencyWithOnlyProvider = Annotated[Redis, Depends(Container.redis)]


@router.get("/values")
Expand Down
9 changes: 3 additions & 6 deletions tests/test_base_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,12 @@
def test_get_providers(container):
providers = container.get_providers()

assert len(providers) > 0

for provider in providers:
assert isinstance(provider, BaseProvider)


def test_get_provider_by_attr_name_fail_on_not_exists_provider(container):
with pytest.raises(Exception):
container.get_provider_by_attr_name("not_exists_provider")


def test_override_providers_fail_with_unknown_provider(container):
unknown_provider = "not_exists_provider"
match = f"Provider with name {unknown_provider!r} not found"
Expand Down Expand Up @@ -72,7 +69,7 @@ def test_reset_singletons(container):

for provider in providers:
if isinstance(provider, Singleton):
_ = provider()
provider()
assert provider._instance is not None

container.reset_singletons()
Expand Down

0 comments on commit b41f880

Please sign in to comment.