New submission from Vinícius Dantas: I have been browsing around the unittest standard library, and I realized that TestCase's shortDescription() method at lib/pythonX.X/unittest/case.py returns None when the there is no docstring on the test that is running. As shortDescription() should obviously return a string, I would recommend returning an empty string instead of None when no docstring is found. This came to mind when I was using testscenario package, which only displays the scenarioname when shortDescription() returns something but None. When we are starting from scratch a test suite, docstrings are left for another stage, when we have running (probably failed, if we are TDDing) unittests. Last yet not least, I am sure it's a good practice to avoid returning None, which forces None-checks, returning empty strings, lists, objects of the return type expected from that function.
---------- components: Tests messages: 288763 nosy: viniciusd priority: normal severity: normal status: open title: Unittest - Return empty string instead of None object on shortDescription() type: behavior versions: Python 3.5 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29686> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com