Catalog pKa parsing edge cases with a comprehensive test suite #11
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The pKa parser in
dissociation_constant.pytries three regex patterns in priority order. The code notes several known false positives (e.g., density values, concentrations) and guards against them by requiring a label match. But there's no systematic accounting of which real-world formats succeed, which fail silently, and which produce wrong values.A comprehensive test matrix does two things. It documents exactly what the parser handles today. And it provides a safety net so future changes don't quietly break formats that used to work.
Scope
Fetch 5–10 pages of real dissociation constant data from PubChem. Inspect the raw
StringWithMarkupvalues by hand and sort them into four categories: parsed correctly, skipped correctly (not a pKa), skipped incorrectly (a valid pKa the regex misses), and parsed incorrectly (extracts the wrong number or label).Write parametrized tests (
@pytest.mark.parametrize) intests/test_dissociation_constant.pyusing the actual raw strings from PubChem. Note the CID each string came from. For each false negative, file a sub-issue or add a# TODOdescribing the unhandled format.Definition of done
At least 30 parametrized test cases drawn from real PubChem data. A summary table in the PR description listing format categories and counts. All currently-passing cases still pass. False negatives are documented, not necessarily fixed.