Skip to content

Cover the untested options, and require pandas 2.1 - #91

Merged
timvink merged 5 commits into
masterfrom
add_missing_tests
Sep 14, 2026
Merged

timvink merged 5 commits into
masterfrom
add_missing_tests

Conversation

@timvink

@timvink timvink commented Sep 14, 2026

Copy link
Copy Markdown
Owner

Fills the gaps I found while reviewing the test suite. Line coverage goes from 94% to 100%, and 56 tests run with none skipped (was 45 passing, 2 permanently skipped).

Tests added

Test Gap it fills
test_select_readers, test_select_readers_unknown The option had no test at all, even though the tag regex was just rewritten around it. Asserts a non-selected read_json tag is left literal, and an unknown reader name aborts with a configuration error. New fixture tests/fixtures/select_readers/.
test_allow_missing_files wrongpath/mkdocs_allow_missing.yml existed but nothing referenced it. Asserts the build succeeds, the tag becomes {{ Cannot find '...' }} and other tables still render.
test_indentation Pins that an indented tag puts its table inside the admonition or content tab instead of after it. New fixture tests/fixtures/indentation/.
test_tags_in_inserted_content A read_raw file that itself contains a tag comes through as-is, which is what the single-pass substitution guarantees. If it were ever re-scanned the build would fail on the missing file.
test_malformed_tags bad_tags.md was being built but never asserted on.
test_add_indentation, test_add_indentation_spaces_and_tabs, test_fix_indentation Neither helper had a unit test. Covers tabs, the no-argument case, the ValueError when both are given, and the round-down-to-4-spaces rule.

I mutation-checked the two load-bearing ones: breaking fix_indentation fails test_indentation and test_fix_indentation, and dropping the reader filter fails test_select_readers.

Tests that existed but never ran

test_read_hdf and test_read_spss skipped on every platform and every Python version, because tables and pyreadstat were not dev dependencies — so read_hdf_file() had never actually run. Both are dev dependencies now and both tests pass.

Breaking change: pandas 2.1 is now the minimum

convert_to_md_table() picked between .map() and .applymap() on a string comparison of pd.__version__, which is also why "10.0.0" >= "2.1.0" would have been False. The .applymap() arm was unreachable in practice: the method was removed in pandas 3, so it could only ever have run on a pandas old enough to still have it. Dropped the branch and raised the floor to pandas>=2.1, the release that added pd.DataFrame.map().

Also

  • Removed utils.cd, which nothing imports.
  • Bumped the version to 4.0.0 for the release.

🤖 Generated with Claude Code

https://claude.ai/code/session_01BFvwQmcc3ekHM351Y5aQeG

timvink and others added 5 commits September 14, 2026 13:02
These were all documented behaviour without a test:

- select_readers: only the selected readers replace their tag, and an
  unknown reader name is a configuration error
- allow_missing_files: a missing table is a warning instead of an error,
  the fixture for it already existed but was never used
- indentation: a table keeps the indentation of its tag, so it ends up
  inside an admonition or content tab instead of after it
- malformed tags are left alone, bad_tags.md was built but never checked
- inserted content is not searched for tags itself, since every tag is
  replaced in a single pass

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BFvwQmcc3ekHM351Y5aQeG
Nothing has imported it since the plugin stopped changing directories.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BFvwQmcc3ekHM351Y5aQeG
Both tests skipped everywhere, including CI, because pytables and
pyreadstat were not dev dependencies. read_hdf_file() had therefore never
run at all.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BFvwQmcc3ekHM351Y5aQeG
The fallback was dead code: it is guarded by a string comparison of
pd.__version__, and pd.DataFrame.applymap() no longer exists in pandas 3.
pd.DataFrame.map(), which replaced it, was added in pandas 2.1.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BFvwQmcc3ekHM351Y5aQeG
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BFvwQmcc3ekHM351Y5aQeG
@timvink timvink changed the title Cover the options and behaviour that had no tests Cover the untested options, and require pandas 2.1 Sep 14, 2026
@timvink
timvink merged commit b819a11 into master Sep 14, 2026
31 checks passed
@timvink
timvink deleted the add_missing_tests branch September 14, 2026 12:08
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.

1 participant