Skip to content

Add test coverage and docstrings for counters module#31

Merged
s3rius merged 2 commits intomasterfrom
copilot/improve-test-docs-coverage
Mar 26, 2026
Merged

Add test coverage and docstrings for counters module#31
s3rius merged 2 commits intomasterfrom
copilot/improve-test-docs-coverage

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 26, 2026

The counters module had zero test coverage and missing docstrings on CounterEntry, Counters, and all Counters methods.

Tests (python/tests/test_counters.py)

  • CountersManager CRUD: create, create_or_update, get, delete, update
  • Counter operations: add, incr, decr, get including negative values, multiple increments, mixed incr/decr, separate subjects
  • Edge cases: nonexistent key raises, config defaults, entry attribute types

Docstrings (counters.pyi)

  • Added class docstrings for CounterEntry and Counters
  • Added method docstrings for add, incr, decr, get with param/return/raises

Stub fix (managers.pyi)

  • CountersManager.update() parameter type corrected from CountersConfigStreamConfig to match the Rust implementation, which accepts StreamConfig:
// src/js/managers/counters.rs:87
pub fn update<'py>(&self, py: Python<'py>, config: StreamConfig) -> ...

Note: callers must set allow_direct=True and allow_message_counter=True on the StreamConfig to avoid NATS rejecting the update.

…ersManager.update stub type

Co-authored-by: s3rius <18153319+s3rius@users.noreply.github.com>
Agent-Logs-Url: https://github.com/taskiq-python/natsrpy/sessions/2733a833-233b-4952-805d-165167131405
@s3rius s3rius marked this pull request as ready for review March 26, 2026 12:48
@s3rius s3rius merged commit 2309ebd into master Mar 26, 2026
8 checks passed
@s3rius s3rius deleted the copilot/improve-test-docs-coverage branch March 26, 2026 12:48
@s3rius s3rius restored the copilot/improve-test-docs-coverage branch March 26, 2026 12:49
@s3rius s3rius deleted the copilot/improve-test-docs-coverage branch March 26, 2026 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants