Skip to content

test: increase test coverage to 98% and fix slab/defect edge cases#21

Merged
ToAmano merged 1 commit into
mainfrom
feat/coverage-fixes
Jun 19, 2026
Merged

test: increase test coverage to 98% and fix slab/defect edge cases#21
ToAmano merged 1 commit into
mainfrom
feat/coverage-fixes

Conversation

@ToAmano

@ToAmano ToAmano commented Jun 19, 2026

Copy link
Copy Markdown
Owner

Description

This PR resolves the remaining untested lines in cli.py and core.py, bringing the overall code coverage to 98% (exceeding the target of 80%). It also fixes a critical bug in surface slab generation and adds robust edge-case validation.

Changes

  • Slab Generation Bug Fix: Corrected the return statement in generate_surface_slab to return the Slab object directly instead of attempting to call the non-existent generate_unique_slab_structs method.
  • Miller Index Validation: Added validation in generate_surface_slab to raise a ValueError if crystallographically invalid zero indices ([0, 0, 0]) are provided.
  • Improved Coverage Tests:
    • Added warning path coverage for mismatching target elements during substitutions and vacancies.
    • Added exception handling path coverage for EspressoAdapter parsing and file reading.
    • Added integration tests for CLI error paths (substitutions, vacancies, and slabs).
    • Added tests for CLI default output filename generation logic.
  • Corrected Existing Tests: Fixed percentage substitutions (reducing composition formula) and random vacancies lattice sizing issues.

@cr-gpt

cr-gpt Bot commented Jun 19, 2026

Copy link
Copy Markdown

Seems you are using me but didn't get OPENAI_API_KEY seted in Variables/Secrets for this repo. you could follow readme for more information

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@ToAmano ToAmano merged commit 691ea71 into main Jun 19, 2026
6 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.

2 participants