Skip to content

test: add 17 tests, fix double-sort bug, update docs and CI#4

Merged
SebTardif merged 6 commits into
mainfrom
fix/improve-mpi-20260702-1
Jul 2, 2026
Merged

test: add 17 tests, fix double-sort bug, update docs and CI#4
SebTardif merged 6 commits into
mainfrom
fix/improve-mpi-20260702-1

Conversation

@SebTardif

Copy link
Copy Markdown
Owner

Summary

Multi-perspective improvement cycle across 14 engineering perspectives. Addresses test gaps, a correctness bug, stale documentation, and CI improvements.

Changes

Tests (17 new)

  • Error path tests: version mismatch, invalid JSON, readonly path persistence
  • SQL coverage: DROP TABLE, non-SELECT query(), repr(), operations on nonexistent tables
  • Parser errors: unexpected tokens, unterminated strings, unexpected characters, empty SQL
  • Type validation: NULL primary key, missing nullable column, duplicate key error messages

Bug fix

  • Double-sort in ORDER BY DESC: _execute_order_by was sorting ascending then re-sorting descending, producing correct results by coincidence but doing redundant work. Fixed to compute direction once.

Refactoring

  • Removed hardcoded sys.path.insert(0, '/home/sebtardif/MiniDB') from 8 test files and main.py
  • Moved import re from inside _match_like() to module level in query.py

Documentation

  • README: fixed test count (29+ to 95+), clone URL placeholder to actual URL, documented LEFT JOIN
  • Added CONTRIBUTING.md with dev setup, pre-commit checks, and conventional commit format

CI

  • Added Python 3.14 to test matrix
  • Added .mypy_cache/ to .gitignore
  • Added Python 3.14 classifier to pyproject.toml

Verification

  • 95 tests pass across Python 3.11-3.14
  • ruff lint and format clean
  • mypy clean

SebTardif added 6 commits July 2, 2026 12:00
Cover previously untested error paths:
- Persistence: VersionMismatchError, invalid JSON, write to unwritable path
- Parser: SyntaxError_ for malformed SQL, unterminated strings, unexpected chars, empty SQL
- Database: query() on non-SELECT, INSERT/UPDATE/DELETE/SELECT on nonexistent table,
  DROP TABLE via SQL, __repr__, NULL on primary key, missing nullable columns,
  DuplicateKeyError message content

Increases test count from 78 to 95.

Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
…evel

Remove hardcoded sys.path.insert(0, '/home/sebtardif/MiniDB') from all
test files and main.py. This path points to a non-existent Linux
directory and is unnecessary since pytest discovers packages via
pyproject.toml.

Move 'import re' from inside _match_like() to query.py module level.

Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
- Update test count from 29+ to 95+
- Replace placeholder clone URL with actual GitHub URL
- Document LEFT JOIN support in Features, SQL Reference, and Limitations
- Add Python 3.14 classifier to pyproject.toml
- Update test_queries.py description to include parser/type tests

Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
- Add Python 3.14 to CI test matrix (already tested locally, classifier
  added in prior commit)
- Add .mypy_cache/ to .gitignore to prevent accidental tracking

Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
When ORDER BY direction was DESC, _execute_order_by sorted the rows
ascending first, then re-sorted descending. This doubled the sort
work for every DESC query. Fixed by computing the reverse flag once
and passing it to a single sorted() call.

Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
New contributors can now find the complete development workflow:
prerequisites, dev tool installation, pre-commit checks matching CI,
conventional commit format, and project structure overview.

README.md now links to CONTRIBUTING.md.

Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
@SebTardif SebTardif merged commit 623f2a1 into main Jul 2, 2026
9 checks passed
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