GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Attempt full test coverage of LocaleTextCalendar.formatweekday · Issue #57539 · python/cpython

Attempt full test coverage of LocaleTextCalendar.formatweekday #57539

New issue
Copy link
New issue
Copy link
Closed
#93468
Closed
Attempt full test coverage of LocaleTextCalendar.formatweekday#57539
#93468
Copy link
Labels
3.11only security fixesonly security fixeseasystdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytestsTests in the Lib/test dirTests in the Lib/test dirtype-featureA feature request or enhancementA feature request or enhancement

Description

SeanFleming
mannequin
opened on Nov 3, 2011
Issue body actions
BPO 13330
Nosy @rhettinger, @terryjreedy, @berkerpeksag, @serhiy-storchaka, @iritkatriel
Files
  • test_calendar.patch
  • issue13330.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = None
    created_at = <Date 2011-11-03.06:14:09.978>
    labels = ['easy', 'tests', 'type-feature', 'library', '3.11']
    title = 'Attempt full test coverage of LocaleTextCalendar.formatweekday'
    updated_at = <Date 2022-03-22.21:27:37.691>
    user = 'https://bugs.python.org/SeanFleming'

    bugs.python.org fields:

    activity = <Date 2022-03-22.21:27:37.691>
    actor = 'iritkatriel'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Library (Lib)', 'Tests']
    creation = <Date 2011-11-03.06:14:09.978>
    creator = 'Sean.Fleming'
    dependencies = []
    files = ['23603', '35060']
    hgrepos = []
    issue_num = 13330
    keywords = ['easy']
    message_count = 6.0
    messages = ['146895', '217316', '255419', '255422', '415814', '415816']
    nosy_count = 7.0
    nosy_names = ['rhettinger', 'terry.reedy', 'jesstess', 'berker.peksag', 'Sean.Fleming', 'serhiy.storchaka', 'iritkatriel']
    pr_nums = []
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue13330'
    versions = ['Python 3.11']

    Activity

    1. SeanFleming commented on Nov 3, 2011

      @SeanFleming
      SeanFlemingmannequin
      on Nov 3, 2011
      MannequinAuthor
      More actions

      Patch includes new statements in test_localecalendars of CalendarTestCase such that coverage of LocaleTextCalendar.formatweekday should improve significantly.

      Feedback is appreciated.

    2. SeanFleming
      added
      testsTests in the Lib/test dirTests in the Lib/test dir
      on Nov 3, 2011
    3. akheron
      added
      stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
      type-featureA feature request or enhancementA feature request or enhancement
      on Nov 3, 2011
    4. jesstess commented on Apr 27, 2014

      @jesstess
      jesstess
      on Apr 27, 2014
      Member
      More actions

      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 < bpo-13330.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)

    5. serhiy-storchaka commented on Nov 26, 2015

      @serhiy-storchaka
      serhiy-storchaka
      on Nov 26, 2015
      Member
      More actions

      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.

    6. serhiy-storchaka commented on Nov 26, 2015

      @serhiy-storchaka
      serhiy-storchaka
      on Nov 26, 2015
      Member
      More actions

      And it looks that only empty locale works on Windows (bpo-21731).

    7. iritkatriel commented on Mar 22, 2022

      @iritkatriel
      iritkatriel
      on Mar 22, 2022
      Member
      More actions

      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.

    8. iritkatriel
      added
      easy
      3.11only security fixesonly security fixes
      on Mar 22, 2022
    9. iritkatriel commented on Mar 22, 2022

      @iritkatriel
      iritkatriel
      on Mar 22, 2022
      Member
      More actions

      See also bpo-25528.

    10. ezio-melotti
      transferred this issue fromon Apr 10, 2022
    11. arhadthedev
      added this to Contribution Queueon Apr 10, 2022
    12. erlend-aasland
      added
      pendingThe issue will be closed if no feedback is providedThe issue will be closed if no feedback is provided
      on May 20, 2022
    13. arhadthedev
      moved this to Todo in Contribution Queueon Jun 2, 2022
    14. AA-Turner commented on Jun 3, 2022

      @AA-Turner
      AA-Turner
      on Jun 3, 2022
      Member
      More actions

      This hasn't been converted into a PR, if someone would like to we can re-open this issue in the future.

      A

    15. AA-Turner
      closed this as not plannedon Jun 3, 2022
    16. AA-Turner
      removed
      pendingThe issue will be closed if no feedback is providedThe issue will be closed if no feedback is provided
      on Jun 3, 2022
    17. hugovk
      added a commit that references this issue on Jun 3, 2022

      pythongh-57539: Increase calendar coverage

      c70a408
    18. hugovk commented on Jun 3, 2022

      @hugovk
      hugovk
      on Jun 3, 2022
      Member
      More actions

      I'll convert it. It might be worth keeping these easy issues open as they're good for new contributors to get started (and linked to from the devguide: https://devguide.python.org/fixingissues/).

      Reacted by Adam Turner and Alex Waygood
    19. hugovk
      reopened this on Jun 3, 2022
    20. ambv
      closed this as completedin #93468on Jun 7, 2022
    21. ambv
      added a commit that references this issue on Jun 7, 2022

      gh-57539: Increase calendar test coverage (GH-93468)

      f0d0be3
    22. miss-islington
      added 2 commits that reference this issue on Jun 7, 2022

      pythongh-57539: Increase calendar test coverage (pythonGH-93468)

      8204c88

      pythongh-57539: Increase calendar test coverage (pythonGH-93468)

      067f015
    23. ambv
      added 2 commits that reference this issue on Jun 7, 2022

      gh-57539: Increase calendar test coverage (GH-93468) (GH-93565)

      b4fdd8c

      gh-57539: Increase calendar test coverage (GH-93468) (GH-93564)

      faf0cf7
    24. bxsx
      added a commit that references this issue on Jun 9, 2022

      pythongh-57539: Add tests for `LocaleTextCalendar.formatweekday`

      ab069a4
    25. serhiy-storchaka
      added a commit that references this issue on Jun 26, 2022

      Revert 30935 defer bpo45162 to 312 (#94285)

      1ffde3e
    26. arhadthedev
      moved this from Todo to Done in Contribution Queueon Apr 23, 2024
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.11only security fixesonly security fixeseasystdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytestsTests in the Lib/test dirTests in the Lib/test dirtype-featureA feature request or enhancementA feature request or enhancement

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions

        You are visitor 01402503 — GeezerVison does not store the pages you look up.
        Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.