Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
bbe0f85
starting on the wizard rewrite
dwhswenson Jul 24, 2021
3cafb36
Merge branch 'main' into wizard-rewrite
dwhswenson Sep 27, 2021
f1df73f
Wizard rewrite for engines
dwhswenson Sep 30, 2021
ac15c65
clean up engines; rewrite cvs
dwhswenson Oct 2, 2021
3c45137
clean up CVs
dwhswenson Oct 2, 2021
4453c3a
Wizard works again!
dwhswenson Oct 6, 2021
c357976
passing tests for most of CVs and half volumes
dwhswenson Oct 6, 2021
1be9867
only 3 failing tests now
dwhswenson Oct 7, 2021
abdbead
fix most tests
dwhswenson Oct 7, 2021
59b5770
tests pass locally
dwhswenson Oct 7, 2021
1bf6a89
Add missing files; make more args kwarg-only
dwhswenson Oct 7, 2021
37323f3
Merge branch 'main' of github.com:openpathsampling/openpathsampling-c…
dwhswenson Oct 8, 2021
366dc73
Merge branch 'main' of github.com:openpathsampling/openpathsampling-c…
dwhswenson Oct 8, 2021
425f925
tests for wizard/helper.py
dwhswenson Oct 9, 2021
3660805
some tests & docstrings
dwhswenson Oct 21, 2021
bba408f
Rename plugins => plugin_registration
dwhswenson Oct 21, 2021
6cfc536
Start plugin_classes with LoadFromOPS
dwhswenson Oct 21, 2021
47c744a
move wizard object plugins into plugin_classes
dwhswenson Oct 21, 2021
36c887d
move WrapCategory to plugin_classes
dwhswenson Oct 22, 2021
f02a367
tests for wizard.parameters,standard_categories
dwhswenson Oct 22, 2021
7e6b55e
add test_parameters.py
dwhswenson Oct 22, 2021
0bc8270
unittest.mock
dwhswenson Oct 22, 2021
8290154
tests for plugin_registration
dwhswenson Oct 22, 2021
bf38703
refactor get_text_from_context
dwhswenson Oct 23, 2021
0d706e6
start to tests for plugin_classes
dwhswenson Oct 23, 2021
0f0e0e0
Tests for object plugin classes
dwhswenson Oct 25, 2021
0a7b981
tests for WrapCategory
dwhswenson Oct 25, 2021
64572a7
finish plugin classes tests
dwhswenson Oct 25, 2021
93e5f9e
missing wizard tests
dwhswenson Oct 25, 2021
934040a
looks like all tests pass with full coverage
dwhswenson Oct 25, 2021
a88a677
some docstrings
dwhswenson Oct 26, 2021
b898478
docstrings
dwhswenson Oct 26, 2021
f8d0db4
add EvalHelperFunc, help for CVs, lambda_min/max
dwhswenson Oct 26, 2021
d7ec33d
fix use of LoadFromOPSFile
dwhswenson Oct 26, 2021
448088e
tests for EvalHelperFunc
dwhswenson Oct 26, 2021
7649c93
Apply suggestions from code review
dwhswenson Oct 27, 2021
9129def
import mock_wizard from mock_wizard
dwhswenson Oct 27, 2021
1474c8d
add debug logging to plugin registration
dwhswenson Oct 27, 2021
da5acdc
Error on duplicate WizardObjectPlugins
dwhswenson Oct 27, 2021
3696d69
Fix lack of context in negated volume
dwhswenson Oct 27, 2021
20aba5a
Apply suggestions from code review
dwhswenson Oct 28, 2021
750bb55
Update the negated volume intro text
dwhswenson Oct 28, 2021
1399860
Merge branch 'wizard-rewrite' of github.com:dwhswenson/openpathsampli…
dwhswenson Oct 28, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
looks like all tests pass with full coverage
  • Loading branch information
dwhswenson committed Oct 25, 2021
commit 934040a9c44d1c18fb3841c0532705f6bd865400
7 changes: 4 additions & 3 deletions paths_cli/tests/wizard/test_plugin_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def test_call(self):

def test_call_with_prereq(self):
# ensure that prerequisites get run if they are provided
def prereq(wizard):
def prereq(wizard, context):
wizard.say("Running prereq")
return {'prereq': ['results']}

Expand Down Expand Up @@ -258,8 +258,9 @@ def setup(self):
self.plugin_format = WizardObjectPlugin(
name="bar",
category="foo",
builder=(lambda wizard, context:
"bar_obj baz={baz}".format(**context)),
prerequisite=lambda wizard, context: {'baz': context['baz']},
builder=(lambda wizard, prereq:
"bar_obj baz={baz}".format(**prereq)),
)

@pytest.mark.parametrize('input_type', ['method', 'None'])
Expand Down
16 changes: 15 additions & 1 deletion paths_cli/tests/wizard/test_volumes.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

from paths_cli.wizard.volumes import (
INTERSECTION_VOLUME_PLUGIN, UNION_VOLUME_PLUGIN, NEGATED_VOLUME_PLUGIN,
CV_DEFINED_VOLUME_PLUGIN, VOLUMES_PLUGIN, volume_intro, _VOL_DESC
CV_DEFINED_VOLUME_PLUGIN, VOLUMES_PLUGIN, volume_intro, _VOL_DESC,
Comment thread
dwhswenson marked this conversation as resolved.
Resolved
volume_ask
)


Expand Down Expand Up @@ -100,6 +101,19 @@ def test_negated_volume(volume_setup):
assert not vol(traj[0])
assert vol(traj[1])

@pytest.mark.parametrize('depth', [0, 1, None])
def test_volume_ask(depth):
context = {0: {'depth': 0},
1: {'depth': 1},
None: {}}[depth]
wiz = mock_wizard([])
result = volume_ask(wiz, context)
if depth == 1:
assert result == "What describes this volume?"
else:
assert result == "What describes this state?"


@pytest.mark.parametrize('periodic', [True, False])
def test_cv_defined_volume(periodic):
if periodic:
Expand Down
2 changes: 1 addition & 1 deletion paths_cli/wizard/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def select_single_existing(self, wizard):
self.create_func)
return self.load_func(obj)

def __call__(self, wizard):
def __call__(self, wizard, context=None):
n_existing = len(getattr(wizard, self.store_name))
if n_existing == self.n_required:
# early return in this case (return silently)
Expand Down
5 changes: 2 additions & 3 deletions paths_cli/wizard/plugin_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,11 @@ def __call__(self, wizard, context=None):
wizard.say(self.intro)

if self.prerequisite is not None:
prereqs = self.prerequisite(wizard)
prereqs = self.prerequisite(wizard, context)
else:
prereqs = {}

context.update(prereqs)
result = self.builder(wizard, context)
result = self.builder(wizard, prereqs)
summary = self.get_summary(wizard, context, result)
for line in summary:
wizard.say(line)
Expand Down
8 changes: 1 addition & 7 deletions paths_cli/wizard/volumes.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,16 @@
from functools import partial

def _binary_func_volume(wizard, context, op):
def summarize(volname):
def inner(wizard, context, result):
return f"The {volname} volume is:\n {str(result)}"

as_state = context.get('depth', 0) == 0
Comment thread
dwhswenson marked this conversation as resolved.
Resolved
wizard.say("Let's make the first constituent volume:")
new_context = volume_set_context(wizard, context, selected=None)
new_context['part'] = 1
new_context['summarize'] = summarize("first")
vol1 = VOLUMES_PLUGIN(wizard, new_context)
wizard.say("Let's make the second constituent volume:")
new_context['part'] = 2
new_context['summarize'] = summarize("second")
vol2 = VOLUMES_PLUGIN(wizard, new_context)
wizard.say("Now we'll combine those two constituent volumes...")
vol = op(vol1, vol2)
# wizard.say(f"Created a volume:\n{vol}")
return vol

_LAMBDA_STR = ("What is the {minmax} allowed value for "
Expand Down