This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2017年04月27日 20:12 by giampaolo.rodola, last changed 2022年04月11日 14:58 by admin. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 1331 | merged | giampaolo.rodola, 2017年04月27日 20:52 | |
| PR 1534 | merged | giampaolo.rodola, 2017年05月10日 13:24 | |
| Messages (14) | |||
|---|---|---|---|
| msg292477 - (view) | Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) | Date: 2017年04月27日 20:12 | |
When comparing 2 numbers as "self.assertAlmostEqual(a, b, delta=1000)" the error message looks like this: AssertionError: 27332885 != 27391120 within 1000 delta Especially when a and b are big numbers or differ a lot, it would be useful to see the absolute difference between the 2 numbers as in: AssertionError: 27332885 != 27391120 within 1000 delta (58235 difference) |
|||
| msg292482 - (view) | Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) | Date: 2017年04月27日 20:53 | |
PR: https://github.com/python/cpython/pull/1331/ |
|||
| msg292510 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2017年04月28日 05:02 | |
Is it worth to output a difference when the delta argument is not passed? Is it worth to output a signed difference rather than an absolute value? |
|||
| msg292537 - (view) | Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) | Date: 2017年04月28日 16:17 | |
Thanks for chiming in. > Is it worth to output a difference when the delta argument is not passed? Yes, probably. I will change that. > Is it worth to output a signed difference rather than an absolute value? Mmmm probably not IMHO. Personally I never care about the position of left and right arguments. I just want to check whether a and b are almost equal. |
|||
| msg292540 - (view) | Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) | Date: 2017年04月28日 17:05 | |
Done. |
|||
| msg292548 - (view) | Author: Raymond Hettinger (rhettinger) * (Python committer) | Date: 2017年04月28日 20:26 | |
The patch looks good to me. |
|||
| msg292668 - (view) | Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) | Date: 2017年05月01日 16:18 | |
New changeset 5d7a8d0c13737fd531b722ad76c505ef47aac96a by Giampaolo Rodola in branch 'master': bpo-30190: improved error msg for assertAlmostEqual(delta=...) (#1331) https://github.com/python/cpython/commit/5d7a8d0c13737fd531b722ad76c505ef47aac96a |
|||
| msg293350 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2017年05月09日 21:30 | |
New test produce deprecation warnings: /home/serhiy/py/cpython/Lib/unittest/test/test_assertions.py:228: DeprecationWarning: invalid escape sequence \( ["^1 != 2 within 7 places \(1 difference\)$", "^oops$", /home/serhiy/py/cpython/Lib/unittest/test/test_assertions.py:229: DeprecationWarning: invalid escape sequence \( "^1 != 2 within 7 places \(1 difference\)$", /home/serhiy/py/cpython/Lib/unittest/test/test_assertions.py:230: DeprecationWarning: invalid escape sequence \( "^1 != 2 within 7 places \(1 difference\) : oops$"]) |
|||
| msg293415 - (view) | Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) | Date: 2017年05月10日 13:02 | |
Mmm I can't see them. Am I supposed to enable this kind of warning somehow? |
|||
| msg293416 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2017年05月10日 13:07 | |
$ ./python -Wa Lib/unittest/test/test_assertions.py Lib/unittest/test/test_assertions.py:228: DeprecationWarning: invalid escape sequence \( ["^1 != 2 within 7 places \(1 difference\)$", "^oops$", Lib/unittest/test/test_assertions.py:229: DeprecationWarning: invalid escape sequence \( "^1 != 2 within 7 places \(1 difference\)$", Lib/unittest/test/test_assertions.py:230: DeprecationWarning: invalid escape sequence \( "^1 != 2 within 7 places \(1 difference\) : oops$"]) ................................... ---------------------------------------------------------------------- Ran 35 tests in 0.052s OK |
|||
| msg293417 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2017年05月10日 13:09 | |
Warnings are not shown when the source is already compiled to .pyc file.
$ find -name '*.py[co]' -exec rm '{}' +
$ ./python -Wa -m test test_unittest
Run tests sequentially
0:00:00 load avg: 0.54 [1/1] test_unittest
/home/serhiy/py/cpython/Lib/unittest/test/test_assertions.py:228: DeprecationWarning: invalid escape sequence \(
["^1 != 2 within 7 places \(1 difference\)$", "^oops$",
/home/serhiy/py/cpython/Lib/unittest/test/test_assertions.py:229: DeprecationWarning: invalid escape sequence \(
"^1 != 2 within 7 places \(1 difference\)$",
/home/serhiy/py/cpython/Lib/unittest/test/test_assertions.py:230: DeprecationWarning: invalid escape sequence \(
"^1 != 2 within 7 places \(1 difference\) : oops$"])
1 test OK.
Total duration: 5 sec
Tests result: SUCCESS
|
|||
| msg293418 - (view) | Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) | Date: 2017年05月10日 13:10 | |
OK thanks. Fix coming. |
|||
| msg299138 - (view) | Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) | Date: 2017年07月25日 21:05 | |
Reopening as it needs backports for 2.7, 3.3, 3.4, 3.5 and 3.6. |
|||
| msg299140 - (view) | Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) | Date: 2017年07月25日 21:06 | |
Sorry, I accidentally picked up the wrong thread. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:58:45 | admin | set | github: 74376 |
| 2017年07月25日 21:06:29 | giampaolo.rodola | set | status: pending -> closed versions: - Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6 messages: + msg299140 resolution: fixed stage: backport needed -> resolved |
| 2017年07月25日 21:05:30 | giampaolo.rodola | set | status: closed -> pending versions: + Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6 messages: + msg299138 resolution: fixed -> (no value) stage: resolved -> backport needed |
| 2017年05月10日 18:13:40 | giampaolo.rodola | set | status: open -> closed |
| 2017年05月10日 13:24:27 | giampaolo.rodola | set | pull_requests: + pull_request1633 |
| 2017年05月10日 13:10:48 | giampaolo.rodola | set | messages: + msg293418 |
| 2017年05月10日 13:09:58 | serhiy.storchaka | set | messages: + msg293417 |
| 2017年05月10日 13:07:19 | serhiy.storchaka | set | messages: + msg293416 |
| 2017年05月10日 13:02:56 | giampaolo.rodola | set | messages: + msg293415 |
| 2017年05月09日 21:30:45 | serhiy.storchaka | set | status: closed -> open messages: + msg293350 |
| 2017年05月05日 07:31:14 | berker.peksag | set | status: open -> closed type: enhancement resolution: fixed components: + Library (Lib) stage: patch review -> resolved |
| 2017年05月01日 16:18:58 | giampaolo.rodola | set | messages: + msg292668 |
| 2017年04月28日 20:26:01 | rhettinger | set | nosy:
+ rhettinger messages: + msg292548 |
| 2017年04月28日 17:05:26 | giampaolo.rodola | set | messages: + msg292540 |
| 2017年04月28日 16:17:48 | giampaolo.rodola | set | messages: + msg292537 |
| 2017年04月28日 05:02:48 | serhiy.storchaka | set | nosy:
+ serhiy.storchaka messages: + msg292510 |
| 2017年04月27日 20:56:33 | giampaolo.rodola | set | title: unittest's assertAlmostEqual should show the difference -> unittest's assertAlmostEqual improved error message |
| 2017年04月27日 20:53:36 | giampaolo.rodola | set | messages:
+ msg292482 stage: needs patch -> patch review |
| 2017年04月27日 20:52:25 | giampaolo.rodola | set | pull_requests: + pull_request1439 |
| 2017年04月27日 20:21:22 | giampaolo.rodola | set | nosy:
+ rbcollins, ezio.melotti, michael.foord |
| 2017年04月27日 20:12:42 | giampaolo.rodola | create | |