-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Maint #33
Merged
Merged
Maint #33
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
ef776b2
allow bonding after branch
fgrunewald 04c01b5
add tests
fgrunewald ff51950
clear bond orders correclty
fgrunewald a083eb6
add tests for multiple bonding descriptors each having a bond order d…
fgrunewald 354aba2
adjust hcount by bonding op number if required
fgrunewald 4624f52
set atomnames also for meta-graph if one is provided
fgrunewald 715e1bc
remove double atomname assignment in resolve
fgrunewald b36f0fc
tests and account for bond order
fgrunewald 48051a1
remove leftovers
fgrunewald 6a11252
add test
fgrunewald File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import re | ||
import pytest | ||
import cgsmiles | ||
|
||
err_msg_rebuild_h = ("Likely you are writing an aromatic molecule that does not " | ||
"show delocalization-induced molecular equivalency and thus " | ||
"is not considered aromatic. For example, 4-methyl imidazole " | ||
"is often written as [nH]1cc(nc1)C, but should be written as " | ||
"[NH]1C=C(N=C1)C. A corresponding CGSmiles string would be " | ||
"{[#A]1[#B][#C]1}.{#A=[>][<]N,#B=[$]N=C[>],#C=[$]C(C)=C[<]}") | ||
|
||
@pytest.mark.parametrize('frag_str, hatoms_ref, error_type, err_msg', ( | ||
('{#A=[$]CCC[$]}', 6, None, None), | ||
('{#A=CCC}', 8, None, None), | ||
('{#A=C[!]CC}', 7, None, None), | ||
('{#A=[$]=CCC=[$]}', 4, None, None), | ||
('{#A=[$]cccc}',5, None, None), | ||
('{#A=[$]ccc}', 0, SyntaxError, err_msg_rebuild_h), | ||
)) | ||
def test_rebuild_hatoms(frag_str, hatoms_ref, error_type, err_msg): | ||
frag_dict = cgsmiles.read_fragments(frag_str) | ||
frag_graph = frag_dict['A'] | ||
if error_type: | ||
with pytest.raises(error_type, match=re.escape(err_msg)): | ||
cgsmiles.pysmiles_utils.rebuild_h_atoms(frag_graph, keep_bonding=True) | ||
else: | ||
cgsmiles.pysmiles_utils.rebuild_h_atoms(frag_graph, keep_bonding=True) | ||
hatoms = 0 | ||
for node, ele in frag_graph.nodes(data='element'): | ||
if ele == 'H': | ||
hatoms += 1 | ||
assert hatoms == hatoms_ref |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add
"CC[$a]=[$b]CC"
?