[issue22452] addTypeEqualityFunc is not used in assertListEqual

2021-08-07 Thread Irit Katriel


Irit Katriel  added the comment:

I've closed issue44819 as a duplicate of this.

--
nosy: +iritkatriel
versions: +Python 3.11 -Python 3.5

___
Python tracker 

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



[issue22452] addTypeEqualityFunc is not used in assertListEqual

2015-08-18 Thread Anton Barkovsky

Changes by Anton Barkovsky an...@swarmer.me:


--
nosy: +anton.barkovsky

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



[issue22452] addTypeEqualityFunc is not used in assertListEqual

2014-11-07 Thread Robert Collins

Robert Collins added the comment:

https://code.google.com/p/unittest-ext/issues/detail?id=11

I think that the hamcrest inspired matchers stuff may help make this a reality 
too. OTOH if we had a clean patch now for the existing asserts that would be 
fine too.

--

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



[issue22452] addTypeEqualityFunc is not used in assertListEqual

2014-11-07 Thread Robert Collins

Robert Collins added the comment:

See also https://code.google.com/p/unittest-ext/issues/detail?id=27

Sorry, wrong wording of the bug.

I tested this on IronPython 2.6.1 and 2.7.b1. I see the same result as you and 
I consider the following wrong or at least misleading:

- [1, Decimal(1), Decimal(2.00)]
?  ^  ---

+ [2, Decimal(1.00), Decimal(2)]
?  ^+++

I mean the +++ and --- under Decimal numbers.

On the other hand I understand that these are differences in string 
representation of those lists...

--

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



[issue22452] addTypeEqualityFunc is not used in assertListEqual

2014-11-01 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
nosy: +rbcollins

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



[issue22452] addTypeEqualityFunc is not used in assertListEqual

2014-09-21 Thread Simon Zack

New submission from Simon Zack:

Functions added by addTypeEqualityFunc is not used for comparing list elements 
in assertListEqual, and only used in assertEqual.

It would be nice to have assertListEqual use functions added by 
addTypeEqualityFunc for comparisons of list elements. I think this provides 
more flexibility, and we get nicely formatted error messages for nested list 
compares for free.

--
components: Library (Lib)
messages: 227210
nosy: simonzack
priority: normal
severity: normal
status: open
title: addTypeEqualityFunc is not used in assertListEqual

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



[issue22452] addTypeEqualityFunc is not used in assertListEqual

2014-09-21 Thread Simon Zack

Changes by Simon Zack simonz...@gmail.com:


--
type:  - enhancement

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



[issue22452] addTypeEqualityFunc is not used in assertListEqual

2014-09-21 Thread Antoine Pitrou

Antoine Pitrou added the comment:

That sounds reasonable to me. Do you want to provide a patch?
See https://docs.python.org/devguide/ for guidelines.

--
nosy: +ezio.melotti, michael.foord, pitrou
stage:  - needs patch
versions: +Python 3.5

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



[issue22452] addTypeEqualityFunc is not used in assertListEqual

2014-09-21 Thread R. David Murray

Changes by R. David Murray rdmur...@bitdance.com:


--
nosy: +r.david.murray

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



[issue22452] addTypeEqualityFunc is not used in assertListEqual

2014-09-21 Thread Ezio Melotti

Ezio Melotti added the comment:

Currently assertListEqual calls assertSequenceEqual, and assertSequenceEqual 
doesn't use any function to compare list elements -- it just does if item1 != 
item2: (https://hg.python.org/cpython/file/default/Lib/unittest/case.py).  
Checking the types of the two items and compare them recursively could be done, 
but it's not as simple as it sounds, since using e.g. assertSequenceEqual will 
raise an error message that will need to be caught and integrated with the 
error message that it's already being constructed, possibly resulting in a long 
and unreadable message.

Since this is a somewhat specific situation, it might be better if you just 
defined your own assert function for nested lists.  In addition to nested lists 
you might have a dictionary that contains lists, or a set of tuples or any 
other combinations of arbitrarily nested containers, and having a generic way 
to handle them all will require quite a lot of work.

One thing that could be done is to add more attributes to the exception raised 
by assertSequenceEqual (and others), so that you could do something like:
try:
self.assertEqual(nested_list1, nested_list2)
except AssertionError as exc:
index = exc.first_differing_index
self.assertEqual(nested_list1[index], nested_list2[index], msg=str(exc))

Not sure how that will look light though, and it's still not a generic 
solution, but if you know what are you dealing with, it might be helpful.

--
nosy: +serhiy.storchaka

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