microsoft / pybryt

Python library for pedagogical auto-assessment
https://microsoft.github.io/pybryt
MIT License
63 stars 19 forks source link

Add a public API for checking values against Value annotations #111

Closed chrispyles closed 3 years ago

chrispyles commented 3 years ago

As titled. For example, to check whether a value annotation is satisfied by some object:

v = pybryt.Value(obj)
v.check_against(other_obj)

Allows instructors to test the robustness of their annotations and engage in unit testing assignments. Also useful for demonstration purposes.

Any method implementing this feature should just wrap the object in the tuple abstraction for a memory footprint observed value and use existing methods to validate the pseudo-footprint.

chrispyles commented 3 years ago

A similar method should also be added to the Attribute annotation.