Skip to content

Add tests for constants and sequence utilities - #47

Merged
dprada merged 6 commits into
mainfrom
codex/add-tests-to-improve-codecov-coverage
Sep 26, 2025
Merged

Add tests for constants and sequence utilities#47
dprada merged 6 commits into
mainfrom
codex/add-tests-to-improve-codecov-coverage

Conversation

@dprada

@dprada dprada commented Sep 25, 2025

Copy link
Copy Markdown
Collaborator

Summary

  • add coverage for the constants helpers including synonym resolution and error handling
  • exercise numpy.repeat helper across value_type options and invalid inputs
  • extend sequence concatenation tests to cover nested sequences and bad configurations

Testing

  • pytest --cov=pyunitwizard

https://chatgpt.com/codex/tasks/task_e_68d5c7d7ce688326a22b05ffd9ca6ab3

@codecov

codecov Bot commented Sep 25, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.39%. Comparing base (1bb3006) to head (f962afc).
⚠️ Report is 7 commits behind head on main.
✅ All tests successful. No failed tests found.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds comprehensive test coverage for constants and sequence utility functions in pyunitwizard. The tests verify error handling, parameter variations, and ensure proper functionality across different value types and configurations.

Key changes:

  • Add complete test suite for constants module including synonym resolution and error handling
  • Extend sequence concatenation tests to cover different value types and nested sequences
  • Add numpy.repeat utility tests with parameter validation

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
tests/test_constants.py New comprehensive test suite for constants module with fixtures and error handling
tests/utils/sequences/test_concatenate.py Extended tests for sequence concatenation with value type parameters and nested sequences
tests/utils/numpy/test_repeat.py Added tests for numpy.repeat utility with value type validation

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread tests/test_constants.py Outdated
Comment thread tests/utils/numpy/test_repeat.py

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting

Comment thread tests/utils/numpy/test_repeat.py
@dprada dprada assigned dprada and Copilot and unassigned dprada and Copilot Sep 26, 2025
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@dprada

dprada commented Sep 26, 2025

Copy link
Copy Markdown
Collaborator Author

@codex solve this CI issue

@dprada

dprada commented Sep 26, 2025

Copy link
Copy Markdown
Collaborator Author

@codex are you trying to solve this CI issue?

@chatgpt-codex-connector

Copy link
Copy Markdown

Summary

  • Added a reusable loaded_libraries context manager so tests can temporarily load optional backends and then restore the prior configuration state. tests/helpers.pyL1-L30
  • Updated the parse and quantity tests to rely on the helper when exercising OpenMM and unyt conversions, preventing KeyErrors when those translators are not preloaded. tests/test_parse.pyL1-L92 tests/test_quantity.pyL1-L25
  • Declared the tests directory as a package to support importing shared testing utilities. tests/init.pyL1-L1

Testing

  • pytest tests/test_parse.py tests/test_quantity.py

View task →

@chatgpt-codex-connector

Copy link
Copy Markdown

Summary

  • Updated parse to raise clear LibraryNotFoundError exceptions when optional openmm.unit or unyt translators are unavailable, preventing unexpected KeyErrors during conversion. pyunitwizard/parse.pyL93-L111
  • Added conditional skip markers in the parse tests so OpenMM and unyt-specific cases only run when the corresponding libraries are loaded. tests/test_parse.pyL1-L102
  • Guarded the OpenMM quantity test behind the same availability check to avoid failures when the backend is missing while keeping other quantity tests intact. tests/test_quantity.pyL1-L30

Testing

  • pytest tests/test_parse.py tests/test_quantity.py

View task →

dprada and others added 4 commits September 25, 2025 18:20
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Handle optional library configuration in parse tests
@dprada
dprada merged commit cd5fa2b into main Sep 26, 2025
7 checks passed
@dprada
dprada deleted the codex/add-tests-to-improve-codecov-coverage branch September 26, 2025 00:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants