I couldn’t stop laughing when I saw this cutest.py on PyPI and LOL after seeing the example screenshot in README, read it and laugh:
Ain’t it cute and adorable? Surely is.
But I am not sure if it’s worth having an extra dependency for this cute little creature. For me, the standard unittest and doctest work just fine, I really don’t get where there are so many better framework or library for testing.
I didn’t run or even install this testing library, just enjoying the fun it can bring to me. From the description of README, it seems to use some descriptive in docstring to instruct this library to perform certain tests.
import cutest as unittest class CoffeMachine(unittest.TestCase): """A good coffee machine""" def test_success(self): """should makes hot drinks""" class Dog(unittest.TestCase): """A typical dog""" def test_barking(self): """should barks loudly""" def test_tail(self): """has a tail""" self.assertTrue(False) class Cat(unittest.TestCase): """A typical cat""" def test_meow(self): """can meow""" print('an onomatopoeia for the voiced sound') def test_fur(self): """has a fur""" if __name__ == "__main__": unittest.main()
It lists a JavaScript library Vows as the inspiration, but for some reason, this reminds me of doctest.js (binned @ 2013-02-18T07:43:12Z), even they are really nothing much alike, except they both utilize comments as where the instructions are.
print(something()) // => expected output
One thing besides the laughter I like is it has a timer for telling you how long the tests run, but it’s just another feature I don’t actually need, nice to have and that’s all. You can easily use time command.
This testing library is unique, at least it’s unique to Python, I am sure someone would like it. cutest.py (GitHub) is written in Python 3.2+ under the MIT License, currently version 0.9.1 (2014-06-30), it was born on 2014-03-02.
Yes, a dog should have a tail.
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.