Skip to content

Conversation

@hagenw
Copy link
Member

@hagenw hagenw commented Jan 24, 2026

Adjusts doctest output to catch object vs. str cases and the new reduced otuput for timedelta[ns] entries in pandas 3.0 (it does now only show 6 places instead of 9, e.g. 00:00:00.063022 instead of 00:00:00.063022023.

Summary by Sourcery

Documentation:

  • Adjust doctest examples to explicitly use object dtype where required and match pandas 3.0 Series and timedelta[ns] display formatting.

* Add failing test

* Make test pandas 3.0.0 compatible

* Fix set_index_dtypes() for pandas 3.0

* Add comment

* Fix doctests

* Update segmented_index()

* Use segmented_index in test

* Add test for segmented_index
* pandas 3.0: fix utils.hash()

* Fix comment

* Remove unneeded code

* Add more tests

* Preserve ordered setting

* Update comment
* Fix categorical dtype with Database.get()

* Update tests

* Add additional test

* Improve code

* Clean up comment

* We converted to categorical data

* Simplify test

* Simplify string test
* Require timedelta64[ns] in assert_index()

* Add tests for mixed cases
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Jan 24, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Updates doctest examples to be compatible with pandas 3.0, explicitly enforcing object dtype in a Series example and adjusting documented/expected timedelta[ns] string representations to match the new 6-decimal-place display format.

File-Level Changes

Change Details Files
Align doctest utilities example with pandas 3.0 Series dtype behavior.
  • Explicitly pass dtype='object' when constructing a Series used in iter_by_file doctest.
  • Ensure the doctest index-based iteration example remains stable across pandas versions by avoiding implicit dtype changes.
audformat/core/utils.py
Update documentation doctest outputs to match pandas 3.0 timedelta[ns] string formatting.
  • Adjust expected string representations of timedelta[ns] values from 9 to 6 decimal places in doctest/output snippets.
  • Ensure combine-tables, data-example, data-misc-tables, and map-scheme docs reflect current pandas 3.0 display behavior for timedelta columns.
docs/combine-tables.rst
docs/data-example.rst
docs/data-misc-tables.rst
docs/map-scheme.rst

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • Consider adding a short inline comment in the doctest explaining why dtype="object" is explicitly specified (to stabilize output across pandas 3.x), so future maintainers don’t “simplify” it back and accidentally break the doctest again.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider adding a short inline comment in the doctest explaining why `dtype="object"` is explicitly specified (to stabilize output across pandas 3.x), so future maintainers don’t “simplify” it back and accidentally break the doctest again.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@hagenw hagenw changed the title pandas 3.0: fix doctests output TST: fix doctests outputs Jan 24, 2026
@codecov
Copy link

codecov bot commented Jan 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.0%. Comparing base (3c88176) to head (c308ae7).
⚠️ Report is 6 commits behind head on dev.

Additional details and impacted files
Files with missing lines Coverage Δ
audformat/core/database.py 100.0% <100.0%> (ø)
audformat/core/index.py 100.0% <100.0%> (ø)
audformat/core/testing.py 100.0% <ø> (ø)
audformat/core/utils.py 100.0% <100.0%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@hagenw hagenw merged commit 7921223 into dev Jan 24, 2026
13 checks passed
@hagenw hagenw deleted the fix-doctests branch January 24, 2026 10:00
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