Skip to content

Add unit tests for loading_data.py and model.py - #4

Open
beta-devin-ai-integration[bot] wants to merge 4 commits into
masterfrom
devin/1783062638-raise-test-coverage
Open

beta-devin-ai-integration[bot] wants to merge 4 commits into
masterfrom
devin/1783062638-raise-test-coverage

Conversation

@beta-devin-ai-integration

@beta-devin-ai-integration beta-devin-ai-integration Bot commented Jul 3, 2026

Copy link
Copy Markdown

Summary

Raises unit test coverage from a single test file to 24 tests, without modifying any source behavior. Branched off devin/1783062025-demo-prep so the CI workflow and existing tests are included.

  • tests/test_loading_data.py — tests loading_FD001 two ways:
    • a synthetic_cmapss fixture that writes tiny synthetic train_FD001.txt / test_FD001.txt / RUL_FD001.txt files into a tmp dir and monkeypatch.chdirs there (since loading_FD001 reads ./CMAPSSData/ relative to cwd). Verifies return types, per-unit group sizes, dropped settings/sensors (s_1, s_5, s_6, s_10, s_16, s_18, s_19), min-max normalization to [0,1], piece-wise RUL (decreasing to 0, clipped at 125), y_test contents, and no RUL column on the test set.
    • a smoke test against the real CMAPSSData/ files (100 units each in train/test/RUL).
  • tests/test_model.py — pure-logic tests using tiny configs (d_model=16, no training): forward output shapes for Transformer, Gating, Encoder, EncoderLayer, MultiHeadAttention, FeedForward, and the attention function; PositionalEncoder output verified against the sin/cos formula; get_clones independence; Norm zero-mean output; Gating.init_weights bounds; and a backward pass producing nonzero gradients.
  • conftest.py — adds a repo_root fixture (was an empty file; no behavior change).
  • .github/workflows/ci.yml:
    • installs CPU-only torch (pip install torch --index-url https://download.pytorch.org/whl/cpu) so the model tests run in CI.
    • pins pandas<3: pandas 3 silently no-ops the chained train_norm['RUL'].clip(upper=125, inplace=True) in loading_data.py, so RUL is no longer clipped. The repo's requirements.txt pins pandas 1.x, so pinning CI (rather than changing source behavior) keeps this PR test-only.

No source files were modified.

Link to Devin session: https://cognition.beta.devinenterprise.com/sessions/a50633ee4f7d422eaed79d5271b084d6
Requested by: @claudiahubert


Devin Review

Status Commit
⚪ Not started

Run Devin Review

Open in Devin Review (Staging)

claudiahubert and others added 3 commits July 3, 2026 07:00
Co-Authored-By: Beta-Devin AI <248786709+beta-devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Beta-Devin AI <248786709+beta-devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Beta-Devin AI <248786709+beta-devin-ai-integration[bot]@users.noreply.github.com>
@beta-devin-ai-integration

Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

…ata)

Co-Authored-By: Beta-Devin AI <248786709+beta-devin-ai-integration[bot]@users.noreply.github.com>
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