Augment functools.cached_property tests for set/delete
Open
Nobody has claimed this yet.
tests
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 35.9k
- PR merge metrics
- PR metrics pending
Description
cached_property supports set and delete but this is not currently tested.
Minimal test extending TestCachedProperty.test_cached:
class TestCachedProperty(unittest.TestCase):
def test_cached(self):
item = CachedCostItem()
self.assertEqual(item.cost, 2)
self.assertEqual(item.cost, 2) # not 3
item.cost = 42
self.assertEqual(item.cost, 42)
del item.cost
self.assertEqual(item.cost, 3)
self.assertEqual(item.cost, 3) # not 4
Linked PRs
- gh-142645
- gh-143393
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in Lib/test/test_functools.py at TestCachedProperty.test_cached, the location named in the issue. Run the focused functools tests first, then extend this test to cover setting and deleting the cached property as shown. Done means the new assertions pass and the existing cached-property behavior remains covered.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing-qa
- Issue type
- Feature
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100