Skip to content

Commit

Permalink
add more coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco committed Oct 6, 2024
1 parent 3087ada commit be1db0e
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/test_init.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""Test imports can happen from top-level."""

import pytest

import propcache
from propcache import _helpers

Expand All @@ -10,3 +12,22 @@ def test_api_at_top_level():
assert propcache.under_cached_property is not None
assert propcache.cached_property is _helpers.cached_property
assert propcache.under_cached_property is _helpers.under_cached_property


def test_public_api_is_in_dir():
"""Verify the public API is accessible in the module's dir()."""
assert "cached_property" in dir(propcache)
assert "under_cached_property" in dir(propcache)


def test_public_api_is_in_all():
"""Verify the public API is accessible in the module's __all__."""
assert "cached_property" in propcache.__all__
assert "under_cached_property" in propcache.__all__


def test_importing_invalid_attr_raises():
"""Verify importing an invalid attribute raises an AttributeError."""
match = r"module 'propcache' has no attribute 'invalid_attr'"
with pytest.raises(AttributeError, match=match):
propcache.invalid_attr

0 comments on commit be1db0e

Please sign in to comment.