carlbordum / datatyping

Pythonic type checking
http://datatyping.readthedocs.io
MIT License
35 stars 4 forks source link

Rewrite tests with hypothesis #14

Closed illright closed 5 years ago

illright commented 5 years ago

This pull request will improve the tests' quality by using the hypothesis library.

Progress:

Fixes #13

illright commented 5 years ago

I chose not to rewrite certain tests (except test_nested_dict) in test_dict_struct.py because I find them irrelevant. I'd like your permission to remove those tests.

I find them irrelevant because they mostly test the lists, for which there's a file of its own.

illright commented 5 years ago

The same goes for some tests in test_list_struct.py. I'd like to get rid of them.

illright commented 5 years ago

Done, please tell me if the tests I mentioned above can be deleted. After that we can consider the work done, I think.

carlbordum commented 5 years ago

Wow @illright!

You've written an absolutely fantastic test suite! Thank you so much.

You appear very competent, so I went ahead and gave you commit permissions (accept on mail). Please know that this is not an obligation in any way and that even a single minute of your time always will be appreciated.

Remove the irrelevant tests. It does seem relevant to test for nested stuff still though.

Again, thanks for your interest in the project - your changes has been merged!

illright commented 5 years ago

@carlbordum You see, with the printer tests we do something like this: assert pformat(dct) == '{a: int, b: str}' In Python 3.5 and less it is not guaranteed that the order of keys will be the same, so this validation will fail because of this: assert '{b: str, a: int}' == '{a: int, b: str}', which is obviously False, but that doesn't mean that the printer failed to do its job.

Because of that, I'd leave out Python 3.5 in tests, it's not like it makes a huge difference in the sense of test coverage.

As for the other things, I've addressed them in the recent commits to master.