Skip to content

gettext: remove unecessary test cases testing single/double quotes #107510

Closed

Description

@tomasr8

Tests for the gettext module include cases which test both single and double quotes:

def test_double_quotes(self):
eq = self.assertEqual
# double quotes
eq(_("albatross"), 'albatross')
eq(_("mullusk"), 'bacon')
eq(_(r"Raymond Luxury Yach-t"), 'Throatwobbler Mangrove')
eq(_(r"nudge nudge"), 'wink wink')

As the comment below suggests, these are not needed to properly test gettext as we are only testing translation lookup. The distinction between single and double quotes would be relevant for testing string extraction but that is not part of gettext. I suggest we remove these test cases.

# TODO:
# - Add new tests, for example for "dgettext"
# - Remove dummy tests, for example testing for single and double quotes
# has no sense, it would have if we were testing a parser (i.e. pygettext)

Linked PRs

Activity

  1. serhiy-storchaka commented on Oct 8, 2023

    @serhiy-storchaka
    Member

    It is not so simply. Yes, the comment suggests to remove these tests, but they should be not syply removed, but replaced with proper tests for pygettext.

    So I suggest to leave the tests and the comment as a reminder.

  2. tomasr8 commented on Oct 8, 2023

    @tomasr8
    MemberAuthor

    If that's the case, would it not make more sense to remove the tests and just update the comment then? So we keep the reminder but not the unnecessary tests

  3. tomasr8 commented on Oct 9, 2023

    @tomasr8
    MemberAuthor

    FWIW, I have a PR which adds more tests to pygettext as well: #108173 Feel free to have a look :)

  4. tomasr8 commented on Dec 14, 2024

    @tomasr8
    MemberAuthor

    Now that tests have been added to pygettext, perhaps it's time to revisit this? @serhiy-storchaka

  5. serhiy-storchaka commented on Dec 14, 2024

    @serhiy-storchaka
    Member

    Sure.

  6. added a commit that references this issue on Feb 14, 2025
  7. StanFromIreland commented on Feb 16, 2025

    @StanFromIreland
    Member

    Can this be closed? They have been removed and replaced.

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

    extension-modulesC modules in the Modules dirtype-featureA feature request or enhancement

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions