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.

Author jesstess
Recipients Sean.Fleming, jesstess, rhettinger, terry.reedy
Date 2014年04月27日.20:43:05
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1398631386.38.0.481423131331.issue13330@psf.upfronthosting.co.za>
In-reply-to
Content
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)
History
Date User Action Args
2014年04月27日 20:43:06jesstesssetrecipients: + jesstess, rhettinger, terry.reedy, Sean.Fleming
2014年04月27日 20:43:06jesstesssetmessageid: <1398631386.38.0.481423131331.issue13330@psf.upfronthosting.co.za>
2014年04月27日 20:43:06jesstesslinkissue13330 messages
2014年04月27日 20:43:05jesstesscreate

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