[issue29747] unittest - assertDoesNotRaise

2017-03-08 Thread Vinícius Dantas

Vinícius Dantas added the comment:

As a last argument:
It is a matter of coherence/consistency with unittest's API, given that
this module does differentiates errors from failures

--

___
Python tracker 
<http://bugs.python.org/issue29747>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29686] Unittest - Return empty string instead of None object on shortDescription()

2017-03-07 Thread Vinícius Dantas

Vinícius Dantas added the comment:

In the point of view of a tester, if it's an error, they will know right
away it is a test case problem, not an assert problem. That makes debugging
easier.
It is also important to note that, if it's an AssertionError, we may add a
message. While, if it is an error, no message would be displayed but the
original Exception's.

As Selenium's example, as I said, was just a use case example.

Finally, having the failure reason explicit is better than keeping it
implicit.

--

___
Python tracker 
<http://bugs.python.org/issue29686>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29747] unittest - assertDoesNotRaise

2017-03-07 Thread Vinícius Dantas

Changes by Vinícius Dantas :


--
pull_requests: +453

___
Python tracker 
<http://bugs.python.org/issue29747>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29747] unittest - assertDoesNotRaise

2017-03-07 Thread Vinícius Dantas

New submission from Vinícius Dantas:

Unittest provides us some assert methods, yet one is missing: the 
assertDoesNotRaise context.
When running tests, tests may end up as failures, successes or errors. It's 
worth noting that errors and failures are conceptually different, and that's 
the point on having an assertDoesNotRaise context, alike the assertRaises 
context.
This context would be useful, for example, when using Selenium client, it would 
be helpful to know if an alert popped, given there is no method to 
check if there is an alert, we'd use a code like:

with assertDoesNotRaise(NoAlertPresentException):
driver.switch_to.alert.text

It is also important to mention that it makes explicit what we are testing. 
After all, explicit is better than implicit.

--
components: Library (Lib)
messages: 289161
nosy: viniciusd
priority: normal
severity: normal
status: open
title: unittest - assertDoesNotRaise
type: enhancement
versions: Python 3.7

___
Python tracker 
<http://bugs.python.org/issue29747>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29686] Unittest - Return empty string instead of None object on shortDescription()

2017-03-01 Thread Vinícius Dantas

Vinícius Dantas added the comment:

If it is tagged for future releases, whoever choose to update their Python
version should expect code breaking and API changes, shouldn't them? I
don't see code breaking as an issue against this request.

On 1 March 2017 at 14:33, Raymond Hettinger  wrote:

>
> Raymond Hettinger added the comment:
>
> It's too late to change this API.  As Serhiy says, it risks breaking code
> that is currently running and correct.
>
> Note the the __doc__ on functions is set to None when there is no
> docstring.  For better or worse, returning None is common in the Python
> world.
>
> --
> nosy: +rhettinger
> resolution:  -> rejected
> stage:  -> resolved
> status: open -> closed
>
> ___
> Python tracker 
> <http://bugs.python.org/issue29686>
> ___
>

-- 
Vinícius Dantas de Lima Melo
Graduando em Ciências e Tecnologia
Universidade Federal do Rio Grande do Norte (UFRN)
Escola de Ciências e Tecnologia (ECT)
Natal, Rio Grande do Norte
vinicius.gpp...@gmail.com viniciusdan...@bct.ect.ufrn.br
vinicius.dantasdelimam...@mail.utoronto.ca | Celular/Mobile Phone: +1 647
447 5737
Skype: viniciusdantas01

--

___
Python tracker 
<http://bugs.python.org/issue29686>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29686] Unittest - Return empty string instead of None object on shortDescription()

2017-03-01 Thread Vinícius Dantas

Changes by Vinícius Dantas :


--
pull_requests: +319

___
Python tracker 
<http://bugs.python.org/issue29686>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29686] Unittest - Return empty string instead of None object on shortDescription()

2017-03-01 Thread Vinícius Dantas

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 
<http://bugs.python.org/issue29686>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com