Repository navigation
Simulation Setup Wizard #41
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
49 commits
Select commit
Hold shift + click to select a range
7af7eae
Add start to wizard
dwhswenson 7fec891
TPS wizard works through state defs
dwhswenson 250f4e2
a little more work on the wizard
dwhswenson 666f9a9
major steps toward TPS wizard
dwhswenson 8910ba2
A little more cleanup on wizard stuff
dwhswenson 0b60338
Start to add tests for wizard
dwhswenson 68066b1
tests for most of the Wizard object
dwhswenson 4da1b9a
move MockConsole, start to get_object decorator
dwhswenson c17f3d1
more work toward using get_object
dwhswenson 77fa5ce
tests for OpenMM wizard
dwhswenson 76ea517
Prep tests for CVs
dwhswenson 5d2e3f8
Some CV cleanup; more periodicity to CVs
dwhswenson b5ec9ce
Wizard ready for 2-state TPS demo
dwhswenson b32d03a
Add tests for CV wizards
dwhswenson a52bac0
tests for volume wizards
dwhswenson a9c4d96
simplify code to reflect current usage
dwhswenson a85118f
more cleanup of unused
dwhswenson 42aa3c9
More tests; work toward handling Spring Shooting
dwhswenson 13f7108
fix up tests
dwhswenson 9d6c3dd
Add tests for shooting, load_from_ops
dwhswenson 6467b59
Remove name from core (used as wizard.name)
dwhswenson d2050e4
Add tests for TPS wizard
dwhswenson 94cd34e
Tests for two_state_tps.py
dwhswenson 3f183de
tests for engines and errors
dwhswenson 35c9ca1
Update for parsing.tools.custom_eval
dwhswenson 97189a6
split off _do_one in wizard
dwhswenson f932fce
Add remaining tests for wizard
dwhswenson a3c7b4b
from unittest import mock...
dwhswenson a7fefd2
missed one
dwhswenson 9259aca
fix for tests locally
dwhswenson 10b676d
try ignoring wizard (does that fix test errors?)
dwhswenson 8b7c8b8
re-include wizard tests
dwhswenson 6c37dce
don't actually monkeypatch when testing Wizard
dwhswenson d444895
fix deprecation warnings for OPS 1.5
dwhswenson 47106e6
Add Wizard (skeleton form) to docs
dwhswenson e9dd815
Add test job with openmm etc integrations
dwhswenson ea29ac4
fix whitespace in yaml
dwhswenson b52c1ef
fix include in yaml
dwhswenson 3b64ce7
fix typo in workflow
dwhswenson 8dcd07d
fix workflow
dwhswenson e774caa
increase fetch-depth to help codecov
dwhswenson d07699e
... helps is fetch-depth is in the right heading
dwhswenson 2ba6390
finish test coverage
dwhswenson 59b6fbe
Add test for bad MDTraj atom index input
dwhswenson 4f3e53a
Add tests/wizard/__init__.py
dwhswenson 0b33b79
no-cov on joke
dwhswenson 60eb119
Apply suggestions from code review
dwhswenson 3d92cd2
misc review cleanup
dwhswenson 07b7d7c
Merge branch 'main' of github.com:openpathsampling/openpathsampling-c…
dwhswenson 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
Start to add tests for wizard
- Loading branch information
commit 0b60338d67114507c54f0dd0596f7dcd507d059b
There are no files selected for viewing
This file contains hidden or 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,12 @@ | ||
| from paths_cli.wizard.wizard import Wizard | ||
| import mock | ||
|
|
||
| def make_mock_wizard(inputs): | ||
| wizard = Wizard([]) | ||
| wizard.console.input = mock.Mock(return_value=inputs) | ||
| return wizard | ||
|
|
||
| def make_mock_retry_wizard(inputs): | ||
| wizard = Wizard([]) | ||
| wizard.console.input = mock.Mock(side_effect=inputs) | ||
| return wizard |
This file contains hidden or 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,51 @@ | ||
| import pytest | ||
| import mock | ||
|
|
||
| from openpathsampling.experimental.storage.collective_variables import \ | ||
| CoordinateFunctionCV | ||
|
|
||
| from paths_cli.wizard.core import * | ||
|
|
||
| from paths_cli.tests.wizard.mock_wizard import ( | ||
| make_mock_wizard, make_mock_retry_wizard | ||
| ) | ||
|
|
||
| def test_name(): | ||
| wizard = make_mock_wizard('foo') | ||
| cv = CoordinateFunctionCV(lambda s: s.xyz[0][0]) | ||
| assert not cv.is_named | ||
| result = name(wizard, cv, obj_type="CV", store_name="cvs") | ||
| assert result is cv | ||
| assert result.is_named | ||
| assert result.name == 'foo' | ||
|
|
||
| def test_name_exists(): | ||
| wizard = make_mock_retry_wizard(['foo', 'bar']) | ||
| wizard.cvs['foo'] = 'placeholder' | ||
| cv = CoordinateFunctionCV(lambda s: s.xyz[0][0]) | ||
| assert not cv.is_named | ||
| result = name(wizard, cv, obj_type="CV", store_name="cvs") | ||
| assert result is cv | ||
| assert result.is_named | ||
| assert result.name == 'bar' | ||
| assert wizard.console.input.call_count == 2 | ||
|
|
||
| @pytest.mark.parametrize('req,expected', [ | ||
| (('foo', 2, 2), '2'), (('foo', 2, float('inf')), 'at least 2'), | ||
| (('foo', 0, 2), 'at most 2'), | ||
| (('foo', 1, 3), 'at least 1 and at most 3') | ||
| ]) | ||
| def test_interpret_req(req, expected): | ||
| assert interpret_req(req) == expected | ||
|
|
||
| @pytest.mark.parametrize('length,expected', [ | ||
| (0, 'foo'), (1, 'baz'), (2, 'quux'), | ||
| ]) | ||
| def test_get_missing_object(length, expected): | ||
| dct = dict([('bar', 'baz'), ('qux', 'quux')][:length]) | ||
| fallback = lambda x: 'foo' | ||
| wizard = make_mock_wizard('2') | ||
| result = get_missing_object(wizard, dct, display_name='string', | ||
| fallback_func=fallback) | ||
| assert result == expected | ||
| pass | ||
This file contains hidden or 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,18 @@ | ||
| import pytest | ||
| import mock | ||
|
|
||
| from paths_cli.wizard.tools import * | ||
|
|
||
| @pytest.mark.parametrize('word,expected', [ | ||
| ('foo', 'a'), ('egg', 'an') | ||
| ]) | ||
| def test_a_an(word, expected): | ||
| assert a_an(word) == expected | ||
|
|
||
|
|
||
| @pytest.mark.parametrize('user_inp,expected', [ | ||
| ('y', True), ('n', False), | ||
| # ('Y', True), ('N', False), ('yes', True), ('no', False) | ||
|
dwhswenson marked this conversation as resolved.
Outdated
|
||
| ]) | ||
| def test_yes_no(user_inp, expected): | ||
| assert yes_no(user_inp) == expected | ||
Empty file.
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,17 +1,5 @@ | ||
|
|
||
| def a_an(obj): | ||
| return "an" if obj[0] in "aeiou" else "a" | ||
| return "an" if obj[0].lower() in "aeiou" else "a" | ||
|
|
||
| def yes_no(char): | ||
| return {'y': True, 'n': False}[char] | ||
|
dwhswenson marked this conversation as resolved.
Outdated
|
||
|
|
||
| def get_int_value(wizard, question, default=None, helper=None): | ||
| as_int = None | ||
| while as_int is None: | ||
| evald = wizard.ask_custom_eval(question, default=default, | ||
| helper=helper) | ||
| try: | ||
| as_int = int(evald) | ||
| except Exception as e: | ||
| wizard.exception("Sorry, I didn't understand that.", e) | ||
| return as_int | ||
This file contains hidden or 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
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.
Uh oh!
There was an error while loading. Please reload this page.