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

Provide mechanism for intent objects to document (and perhaps enforce) types for inputs and outputs #4

Closed
itamarst opened this issue Jul 12, 2014 · 4 comments

Comments

@itamarst
Copy link

In a language with a good type system you can be sure that the result you swapped in as part of a test vaguely make sense. In Python it's easy to write tests using mocks or resolved values where you end up testing against return types that don't match what the real function returns.

Perhaps intent objects should have a way document or provide validation functions for the return types and callable arguments. Then tests that use resolve_effect (as well as those that test the intent itself) can automatically ensure the tests are using the correct types.

@radix
Copy link
Contributor

radix commented Jul 13, 2014

The title of this ticket doesn't really make sense as a bug. Can you please rewrite it?

@itamarst itamarst changed the title resolve_effect and claim that mocking is OK ignore lack of static typing Provide mechanism for intent objects to document (and perhaps enforce) types for inputs and outputs Jul 14, 2014
@radix
Copy link
Contributor

radix commented Aug 6, 2014

I'm sorry I didn't notice this change when you made it, I don't think github sent me a notification :-(

Anyway, that title is a lot more helpful, thank you. However, I would suggest that this is probably something that a separate library should tackle. It should be easy enough to apply a static-typing wrapper to your intent objects and perform implementations. Does that sound reasonable?

@wilbertom
Copy link

@itamarst I was playing with the idea of doing this in python a while back. I haven't really shown anyone though. You can do things like strict type checking for example is_list, or you can do other things that mimic Haskell's type classes for example is_iterable. Sorry if I misinterpretted your issue.

https://github.com/wilbertom/contracts

@radix
Copy link
Contributor

radix commented Aug 14, 2014

You may also want to check out MyPy, which adds static typing to Python.

I'll close this issue for now, since I think it's clear this is the responsibility of other libraries.

@radix radix closed this as completed Aug 14, 2014
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

No branches or pull requests

3 participants