[issue18106] There are unused variables in Lib/test/test_collections.py

2013-07-07 Thread Ezio Melotti
Ezio Melotti added the comment: Fixed, thanks for the patch! -- assignee: -> ezio.melotti resolution: -> fixed stage: -> committed/rejected status: open -> closed type: -> enhancement ___ Python tracker ___

[issue18106] There are unused variables in Lib/test/test_collections.py

2013-07-07 Thread Roundup Robot
Roundup Robot added the comment: New changeset a5010de76eda by Ezio Melotti in branch 'default': #18106: refactor tests to use subtests and proper assert methods. Patch by Vajrasky Kok. http://hg.python.org/cpython/rev/a5010de76eda -- nosy: +python-dev

[issue18106] There are unused variables in Lib/test/test_collections.py

2013-06-09 Thread Vajrasky Kok
Vajrasky Kok added the comment: Fixed the test based on Ezio Melotti's advice. However, Ezio did not comment specifically about whether we should cut or keep this line. self.assertEqual(list(dup.items()), list(od.items())) After studying the OrderedDict source code, I came to conclusion that

[issue18106] There are unused variables in Lib/test/test_collections.py

2013-06-08 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- nosy: +rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.

[issue18106] There are unused variables in Lib/test/test_collections.py

2013-06-01 Thread Vajrasky Kok
Vajrasky Kok added the comment: I redo the test as Terry J. Reedy suggested. I use label in loop, utilize subTest receiving label parameter, and pass messages to only necessary asserts. So roughly if the test fails, we would get something like this:

[issue18106] There are unused variables in Lib/test/test_collections.py

2013-06-01 Thread Terry J. Reedy
Terry J. Reedy added the comment: > becouse we have no a string which determine a test. The original loop could be have been written as (or be changed to) for label, dup in [ ('odcopy', od.copy()), ('copycopy', copy.copy(words)), ] and the label used to identify

[issue18106] There are unused variables in Lib/test/test_collections.py

2013-06-01 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: subTest() serves two purposes: identify the test case and continue testing oother test cases after a fail. For first purpose subTest() is not well suitable in these tests, becouse we have no a string which determine a test. Second purpose is not relevant to ori

[issue18106] There are unused variables in Lib/test/test_collections.py

2013-06-01 Thread Terry J. Reedy
Terry J. Reedy added the comment: To me, there are two independent improvements: using i and hence msg to identify the erroneous dup, and using .subTest to test all dups. I would combine ideas from both the first two patches to do both. 1. a fancy formatted message would be more useful with le

[issue18106] There are unused variables in Lib/test/test_collections.py

2013-05-31 Thread Vajrasky Kok
Vajrasky Kok added the comment: Anyway to make it complete, I upload the patch according to Storchaka's advice too. May the best patch wins! -- Added file: http://bugs.python.org/file30434/test_copying_with_def.patch ___ Python tracker

[issue18106] There are unused variables in Lib/test/test_collections.py

2013-05-31 Thread Vajrasky Kok
Vajrasky Kok added the comment: According to R. David Murray in Python core-mentorship mailing list addressing me: "It could be that the bug is that the i is not used...it may have been intended to be used in an extended error message in the asserts, so that it would be clear which input failed

[issue18106] There are unused variables in Lib/test/test_collections.py

2013-05-31 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Perhaps it will be even better to extract loop body as a local function and then call it with different arguments. def check(dup): self.assertTrue(dup is not od) self.assertEqual(dup, od) ... check(od.copy()) check(copy.cop

[issue18106] There are unused variables in Lib/test/test_collections.py

2013-05-31 Thread Vajrasky Kok
New submission from Vajrasky Kok: In two "test_copying" methods in Lib/test/test_collections.py, variable i is never used. My guess is the original test writer forgot to utilize the variable i. For example, in test_copying method in TestOrderedDict class: def test_copying(self): #