[issue33284] Increase test coverage for numbers.py

2018-04-26 Thread Barry Devlin

Barry Devlin  added the comment:

Hey,

I updated my pull request based in your advice. Could you review it please?

Best,

Barry

On Sat, 21 Apr 2018, 03:20 Terry J. Reedy,  wrote:

>
> Terry J. Reedy  added the comment:
>
> Barry, thank you for your first submission.
>
> You propose to test numbers.Complex.__bool__
>
> def __bool__(self):
> """True if self != 0. Called for bool(self)."""
> return self != 0
>
> by adding the following to Lib/test/test_abstract_numbers.
>
> +self.assertFalse(bool(complex(0,0)))
> +self.assertTrue(bool(complex(1,2)))
>
> I believe that this particular addition should be rejected.  It is a
> concrete test of the builtin complex that partially duplicates the
> following in test_complex.
>
> def test_boolcontext(self):
> for i in range(100):
> self.assertTrue(complex(random() + 1e-6, random() + 1e-6))
> self.assertTrue(not complex(0.0, 0.0))
>
> Looking the tests of collections.abc in test_collections, I believe a
> proper test should define a subclass of Complex (in Python), with at least
> __init__ and __eq__ methods and test instances of *that*.
>
> If I were to review a patch, I would like to see a more extensive
> addition, one that imports test_collections.ABCTestCase (or copies and
> adapts the same) and uses it to test a much fuller implementation of
> Complex.  As it is, none of the numbers abc class methods are tested.
>
> Raymond, were you involved with the abc tests? Either way, what do you
> think?
>
> --
> nosy: +rhettinger, terry.reedy
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue33284] Increase test coverage for numbers.py

2018-04-20 Thread Terry J. Reedy

Change by Terry J. Reedy :


--
stage: patch review -> needs patch
type:  -> enhancement

___
Python tracker 

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



[issue33284] Increase test coverage for numbers.py

2018-04-20 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

Barry, thank you for your first submission.

You propose to test numbers.Complex.__bool__

def __bool__(self):
"""True if self != 0. Called for bool(self)."""
return self != 0

by adding the following to Lib/test/test_abstract_numbers.

+self.assertFalse(bool(complex(0,0)))
+self.assertTrue(bool(complex(1,2)))

I believe that this particular addition should be rejected.  It is a concrete 
test of the builtin complex that partially duplicates the following in 
test_complex.

def test_boolcontext(self):
for i in range(100):
self.assertTrue(complex(random() + 1e-6, random() + 1e-6))
self.assertTrue(not complex(0.0, 0.0))

Looking the tests of collections.abc in test_collections, I believe a proper 
test should define a subclass of Complex (in Python), with at least __init__ 
and __eq__ methods and test instances of *that*.

If I were to review a patch, I would like to see a more extensive addition, one 
that imports test_collections.ABCTestCase (or copies and adapts the same) and 
uses it to test a much fuller implementation of Complex.  As it is, none of the 
numbers abc class methods are tested.

Raymond, were you involved with the abc tests? Either way, what do you think?

--
nosy: +rhettinger, terry.reedy

___
Python tracker 

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



[issue33284] Increase test coverage for numbers.py

2018-04-15 Thread Roundup Robot

Change by Roundup Robot :


--
keywords: +patch
pull_requests: +6180
stage:  -> patch review

___
Python tracker 

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



[issue33284] Increase test coverage for numbers.py

2018-04-15 Thread Barry Devlin

New submission from Barry Devlin :

The __bool__ method in the complex class in numbers is not tested.

--
components: Tests
messages: 315337
nosy: Barry Devlin
priority: normal
severity: normal
status: open
title: Increase test coverage for numbers.py
versions: Python 3.8

___
Python tracker 

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