homepage

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.

classification
Title: Attempt full test coverage of LocaleTextCalendar.formatweekday
Type: enhancement Stage: patch review
Components: Library (Lib), Tests Versions: Python 3.11
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Sean.Fleming, berker.peksag, iritkatriel, jesstess, rhettinger, serhiy.storchaka, terry.reedy
Priority: normal Keywords: easy

Created on 2011年11月03日 06:14 by Sean.Fleming, last changed 2022年04月11日 14:57 by admin.

Files
File name Uploaded Description Edit
test_calendar.patch Sean.Fleming, 2011年11月03日 06:14 review
issue13330.patch jesstess, 2014年04月27日 20:43 review
Messages (6)
msg146895 - (view) Author: Sean Fleming (Sean.Fleming) Date: 2011年11月03日 06:14
Patch includes new statements in test_localecalendars of CalendarTestCase such that coverage of LocaleTextCalendar.formatweekday should improve significantly. 
Feedback is appreciated.
msg217316 - (view) Author: Jessica McKellar (jesstess) * (Python triager) Date: 2014年04月27日 20:43
Thanks for working to increase our test coverage, Sean.Fleming!
Looking at the current coverage, the there is one line in LocaleTextCalendar.formatweekday without coverage: http://hg.python.org/cpython/file/e159cb0d955b/Lib/calendar.py#l519.
You add some additional tests, but they are mostly testing some very literal aspects of the implementation rather than the purpose of the function. For example:
+ self.assertRaises(IndexError, calendar.LocaleTextCalendar(locale='').formatweekday, 7, 1 )
It's true that this will raise an IndexError, but formatweekday isn't supposed to be called with these values.
I've added some tests that add coverage for the line that didn't have coverage, while focusing on the purpose of the function, namely to provide an appropriate day name when constrained to various widths.
* The patch passes the full test suite
* The patch passes `make patchcheck`
* The patch results in full coverage for LocaleTextCalendar.formatweekday
Coverage results, before and after:
$ ./python.exe ../coveragepy/ run --pylib --source=calendar Lib/test/regrtest.py test_calendar
[1/1] test_calendar
1 test OK.
nitefly:cpython jesstess$ ./python.exe ../coveragepy/ report --show-missing
Name Stmts Miss Cover Missing
--------------------------------------------
Lib/calendar 375 54 86% 511, 519, 541, 608-699, 703
$ patch -p1 < issue13330.patch 
patching file Lib/test/test_calendar.py
patching file Misc/ACKS
$ ./python.exe ../coveragepy/ run --pylib --source=calendar Lib/test/regrtest.py test_calendar
[1/1] test_calendar
1 test OK.
nitefly:cpython jesstess$ ./python.exe ../coveragepy/ report --show-missing
Name Stmts Miss Cover Missing
--------------------------------------------
Lib/calendar 375 53 86% 511, 541, 608-699, 703
(519 was the one line without coverage inside LocaleTextCalendar.formatweekday)
msg255419 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2015年11月26日 14:48
The test depends on the en_US locale. Only existing of POSIX locale is guarantied. The test should be skipped instead of failed if the en_US locale is not available. It would be nice to test also with other locales. For example with de_DE, fr_FR, tr_TR, ps_AF - these locales are used also in other tests.
msg255422 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2015年11月26日 15:04
And it looks that only empty locale works on Windows (issue21731).
msg415814 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2022年03月22日 21:24
The patch needs to be reviewed. If the tests are still relevant and increase coverage, it needs to be converted to a GitHub PR. Otherwise this issue can be closed.
msg415816 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2022年03月22日 21:27
See also issue25528.
History
Date User Action Args
2022年04月11日 14:57:23adminsetgithub: 57539
2022年03月22日 21:27:37iritkatrielsetmessages: + msg415816
2022年03月22日 21:24:56iritkatrielsetversions: + Python 3.11, - Python 3.4, Python 3.5
nosy: + iritkatriel

messages: + msg415814

keywords: + easy, - patch, needs review
2015年11月26日 15:04:43serhiy.storchakasetmessages: + msg255422
2015年11月26日 14:48:12serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg255419
2015年01月29日 01:20:40berker.peksagsetnosy: + berker.peksag

versions: + Python 3.4
2014年04月27日 20:43:06jesstesssetfiles: + issue13330.patch
versions: + Python 3.5, - Python 3.3
nosy: + jesstess

messages: + msg217316
2011年11月04日 22:42:18terry.reedysetnosy: + rhettinger, terry.reedy
2011年11月03日 08:58:03petri.lehtinensetkeywords: + needs review
stage: patch review
type: enhancement
components: + Library (Lib)
versions: + Python 3.3, - Python 3.4
2011年11月03日 06:14:10Sean.Flemingcreate

AltStyle によって変換されたページ (->オリジナル) /