Fix numerous logic errors from historical lack of tests#212
Conversation
…est coverage to 87%
|
Thank you! I see that you also implemented a The tests pass for me locally on Python 3.12 but they do fail on 3.11: $ python -m unittest test_proforma.ProFormaTest.test_fragments
E
======================================================================
ERROR: test_fragments (test_proforma.ProFormaTest.test_fragments)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/levitsky/pyteomics/tests/test_proforma.py", line 166, in test_fragments
for o, e in zip(i.fragments("b"), b_expected):
^^^^^^^^^^^^^^^^
File "/home/levitsky/pyteomics/pyteomics/proforma.py", line 4222, in fragments
intervals = sorted(intervals, key=lambda x: x.start, reverse=reverse)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'NoneType' object cannot be interpreted as an integer
----------------------------------------------------------------------
Ran 1 test in 0.002s
FAILED (errors=1) |
|
Okay, no clue where that |
|
Thank you. Before merging, I want to try it out and add some more tests potentially around In [1]: from pyteomics import proforma
In [2]: proforma.ProForma.parse('PEPTIDE', chimeric=True)
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[2], line 1
----> 1 proforma.ProForma.parse('PEPTIDE', chimeric=True)
File ~/pyteomics/pyteomics/proforma.py:4084, in ProForma.parse(cls, string, chimeric, **kwargs)
4082 result = parse(string, chimeric=chimeric, **kwargs)
4083 if chimeric:
-> 4084 return Chimeric([cls(*component) for component in result], result.chimeric)
4085 return cls(*result)
AttributeError: 'list' object has no attribute 'chimeric'I will have more time next week to look into it. |
|
I missed the fast path, thank you for checking that. I also realized I could actually use pattern matching freely in unit tests now that Py310 is the minimal version, which caught another syntactic issue. |
levitsky
left a comment
There was a problem hiding this comment.
Thank you!
I noticed an issue with ProteoformCombinator that I missed before because I didn't bother to test fixed modifications. I took a guess at a fix because the semantics of those ModificationRuleDirective creation methods and the class itself are not entirely clear to me, and multiple errors shown by static type checkers don't help.
Could you check if ProteoformCombinator._apply_fixed_modifications makes sense?
|
Thanks again! Should I merge now? |
|
Yes please.
…On Tue, Jul 14, 2026, 12:11 PM Lev Levitsky ***@***.***> wrote:
*levitsky* left a comment (levitsky/pyteomics#212)
<#212 (comment)>
Thanks again! Should I merge now?
—
Reply to this email directly, view it on GitHub
<#212?email_source=notifications&email_token=AAK4E6N2JWHOF3VB25WXRQ35EZLTHA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIOJXGEZTOOJSGM22M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KYZTPN52GK4S7MNWGSY3L#issuecomment-4971379235>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAK4E6MAW3J3EPUO3NSWH2T5EZLTHAVCNFSNUABFKJSXA33TNF2G64TZHMZDINBQGM4DANJVHNEXG43VMU5TINZWGQ2TIOBTGA42C5QC>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/AAK4E6N6PQMCY2ERURXHTPL5EZLTHA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIOJXGEZTOOJSGM22M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KUZTPN52GK4S7NFXXG>
and Android
<https://github.com/notifications/mobile/android/AAK4E6L3YGNABRFJPTRIFVL5EZLTHA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIOJXGEZTOOJSGM22M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2K4ZTPN52GK4S7MFXGI4TPNFSA>.
Download it today!
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Addresses the lingering issue from #209
Fix #211, making tag resolution failure a non-fatal error at parse time. Still invokes resolvers, but doesn't crash if they fail.
Amongst other things, I plugged a bunch of holes in the hand-rolled state machine where state transitions didn't exist, or had muddled invariant management for bizarre scenarios.