Skip to content
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

Named annotation message filtering does not work correctly when no failure message is supplied #145

Closed
chrispyles opened this issue Jan 6, 2022 · 0 comments · Fixed by #148

Comments

@chrispyles
Copy link
Contributor

If no failure message is supplied but a success message is in a group of named annotations and one of the annotations is not satisfied, the success message is shown even though the reference registers as not being satisfied. In this case, no message should be shown.

Example:

max_ref = []
def maximum(l, track=False):
    m = max(l)
    if track:
        max_ref.append(pybryt.Value(m, name="list-maximum", success_message="Found the max!")
    return m

test_lists = [[1, 2, 3], [-1, 0, 1], [10, -4, 2, 0], [1]]
for test_list in test_lists:
    maximum(test_list, track=True)

max_ref = pybryt.ReferenceImplementation("maximum", max_ref)

def maximum(l):
    if len(l) % 2 == 0:
        m = min(l)
    else:
        m = max(l)
    return m

with pybryt.check(max_ref):
    for test_list in test_lists:
        maximum(test_list)
chrispyles added a commit to chrispyles/pybryt that referenced this issue Jan 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant