Skip to content

Commit

Permalink
Merge branch 'main' into 2023-sep3-loosen-alg-test-tolerance
Browse files Browse the repository at this point in the history
  • Loading branch information
AustinT authored Sep 8, 2023
2 parents 05029cf + 6432a71 commit c182baa
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ and the project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.

### Fixed

- Fix bug where standardizing MolSetGraphs crashed ([#24](https://github.com/microsoft/syntheseus/pull/24)) ([@austint])
- Change default node depth to infinity ([#16](https://github.com/microsoft/syntheseus/pull/16)) ([@austint])
- Adapt tutorials to the renaming from PR #9 ([#17](https://github.com/microsoft/syntheseus/pull/17)) ([@jagarridotorres])
- Pin `pydantic` version to `1.*` ([#10](https://github.com/microsoft/syntheseus/pull/10)) ([@kmaziarz])
Expand Down
2 changes: 1 addition & 1 deletion syntheseus/search/graph/standardization.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def _unique_node_andor_from_molset(
# Get all mols and reactions
all_nodes: set[MolSetNode] = set(graph._graph.nodes())
mols = set(mol for node in all_nodes for mol in node.mols)
rxns = set(edge["reaction"] for edge in graph._graph.edges())
rxns = set(graph._graph.edges[n1, n2]["reaction"] for n1, n2 in graph._graph.edges())

# Make initial nodes
mol_to_node = {mol: OrNode(mol) for mol in mols}
Expand Down
24 changes: 23 additions & 1 deletion syntheseus/tests/search/graph/test_standardization.py
Original file line number Diff line number Diff line change
@@ -1 +1,23 @@
"""Graph standardization is not tested at this time, but should be tested in the future."""
"""
At the moment, only a smoke-test is done for graph standardization,
but the exact behaviour is not well-tested.
These tests should be added in the future.
"""

import pytest

from syntheseus.search.graph.and_or import AndOrGraph
from syntheseus.search.graph.molset import MolSetGraph
from syntheseus.search.graph.standardization import get_unique_node_andor_graph


def test_smoke_andor(andor_graph_non_minimal: AndOrGraph):
with pytest.warns(UserWarning):
output = get_unique_node_andor_graph(andor_graph_non_minimal)

assert len(output) == len(andor_graph_non_minimal) # no nodes deleted here


def test_smoke_molset(molset_tree_non_minimal: MolSetGraph):
with pytest.warns(UserWarning):
get_unique_node_andor_graph(molset_tree_non_minimal)

0 comments on commit c182baa

Please sign in to comment.