Skip to content

Conversation

@GeorgWa
Copy link
Collaborator

@GeorgWa GeorgWa commented Dec 6, 2025

Summary

  • Add tests for set_modification_mapping with string argument (yaml lookup code path)
  • Add test for Protein_N-term vs Any_N-term precedence in reverse mapping
  • Add test documenting that add_modification_mapping overwrites existing key values
  • Clarify docstring to reflect actual behavior: new keys added, existing keys overwritten

🤖 Generated with Claude Code

GeorgWa and others added 2 commits December 6, 2025 22:03
Test coverage for:
- Initialization with empty/mapping type/custom mappings
- Reverse mapping creation (single and list formats)
- add_modification_mapping method
- UniMod extension functionality

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Test set_modification_mapping with string argument (yaml lookup path)
- Test Protein_N-term vs Any_N-term precedence in reverse mapping
- Test that add_modification_mapping overwrites existing key values
- Clarify docstring: new keys added, existing keys overwritten

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@GeorgWa GeorgWa changed the title Add high-priority test coverage for ModificationMapper Shameless Claude test coverage for ModificationMapper Dec 6, 2025
@GeorgWa GeorgWa requested review from Copilot and mschwoer December 6, 2025 21:16
Copy link

Copilot AI left a comment

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 unit test coverage for the ModificationMapper class, focusing on previously untested code paths and edge cases. The tests validate initialization scenarios, mapping operations, and reverse mapping behavior.

Key Changes:

  • Added 13 new test cases covering initialization, mapping updates, and reverse mapping generation
  • Updated add_modification_mapping docstring to clarify that existing keys are overwritten rather than extended
  • Tests document important behaviors like Any_N-term precedence over Protein_N-term in reverse mappings

Reviewed changes

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

File Description
tests/unit/psm_reader/test_modification_mapper.py New test file with comprehensive coverage for ModificationMapper initialization, mapping operations, and edge cases
alphabase/psm_reader/modification_mapper.py Clarified docstring to document that add_modification_mapping overwrites existing keys rather than extending them

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

)

# new key is added
assert "Acetyl@K" in mapper.modification_mapping
Copy link
Contributor

Choose a reason for hiding this comment

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

could you just assert mapper.modification_mapping == expected ?

Copy link
Contributor

Choose a reason for hiding this comment

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

(also in other tests)

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.

3 participants