Skip to content

Add Python test suite for note component parser library #128

Description

@junior-ricon

Problem

KnickKnackLabs/notes#127 adds the first explicit Python note-component parser surface (notes parse + lib/note_components.py). The PR kept BATS coverage for CLI behavior, but the library semantics are now substantial enough that they should eventually have a proper Python test suite.

During review, Or also caught that Python assertions embedded as single-line python3 -c commands in BATS are not acceptable. #127 fixed that locally by making the BATS assertions readable, and KnickKnackLabs/codebase#47 tracks a future lint for that smell. This issue tracks the more structural follow-up: test Python library semantics in Python.

Proposal

Add a small Python test suite for Python library code in notes, probably using pytest.

Suggested shape:

  • Add pyproject.toml for Python test/dev dependencies.
  • Add pytest as a dev/test dependency.
  • Add a mise task such as test:python or integrate Python tests into the existing test task.
  • Add tests under test/python/ or tests/ for:
    • parse_frontmatter_text;
    • parse_mapping_text;
    • parse_note_text / read_note_components;
    • malformed frontmatter remains body text;
    • comments/future conventions remain body text;
    • block-list parsing behavior already used by list/show/search.

BATS should remain the CLI/integration layer:

  • notes parse <file> works through mise;
  • NOTES_CALLER_PWD path resolution works;
  • missing note exits nonzero;
  • JSON is emitted.

Why not in #127

#127 is already the parser foundation PR and was intentionally narrowed several times: no notes read, no backmatter/banknotes, direct uv task, readable BATS assertions. Adding pytest in the same PR would widen scope. This is better as a follow-up once #127 lands.

Acceptance criteria

  • Python parser/library behavior is covered by a Python test suite.
  • Existing BATS parse tests are reduced to CLI integration checks where appropriate.
  • The main mise run test path runs both BATS and Python tests, or the README clearly documents both test commands.
  • No Python assertion one-liners remain in BATS for parser/library semantics.

Related

  • Parser PR: KnickKnackLabs/notes#127
  • Original read/query proposal: KnickKnackLabs/notes#126
  • Future BATS lint: KnickKnackLabs/codebase#47
  • Fold guidance: fold/notes/bats-tool-testing.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions