Skip to content

Testing for "universal" assumptions #141

Answered by pschanely
harahu asked this question in Q&A
Discussion options

You must be logged in to vote

This is a really interesting topic.

First off, yes, CrossHair is a good tool for handling these kinds of problems. In particular, take a look at this example which uses a mixin to let classes opt-in to hash-eq consistency testing.

Now that's not quite what you're looking for: you want a tool to automatically apply this requirement.

One idea I've been toying with: an officially supported way to apply contracts to external classes that you don't control. With that kind of feature, you could apply a contract to object, I suppose, which would do what you want.

Indeed, one could imagine a variety of other universal contracts; maybe stuff like this?:

  • __lt__ is irreflexive, antisymmetric, and t…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@harahu
Comment options

@pschanely
Comment options

@harahu
Comment options

Answer selected by harahu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants