Skip to content

Add pytest unit tests for Tokenizer & Parser + small integration test #1

Description

@Karlitos911

Add automated tests to protect the parser and generator from regressions. Tests should be callable via pytest and run quickly.
What to test (suggested)

Unit test: Tokenizer produces expected token sequence for a small .music snippet.

Unit test: Parser.parse_program() returns a MusicNode with expected nome, bpm, and at least one instrument.

Integration test: Parse a small .music string, evaluate it into context, call criar_midi_com_duracoes(...) with tmp_path output and assert .mid file is generated and non-empty.

Acceptance criteria

pytest runs and all tests pass locally after pip install -r requirements.txt.

Tests are under tests/ and use only pytest and mido.

Test files are clear and minimal; no external network required.

Notes / pointers

The parser/tokenizer code lives in aps_logcomp/main.py. Add aps_logcomp/init.py to make it importable from tests.

If tests fail due to minor token name mismatches, adjust expectations accordingly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions