Blame translation-canary/translation_canary/translatable/test_comment.py

Packit b040ce
# Check that a string that needs a comment has one
Packit b040ce
# # Copyright (C) 2015  Red Hat, Inc.
Packit b040ce
#
Packit b040ce
# This copyrighted material is made available to anyone wishing to use,
Packit b040ce
# modify, copy, or redistribute it subject to the terms and conditions of
Packit b040ce
# the GNU Lesser General Public License v.2, or (at your option) any later
Packit b040ce
# version. This program is distributed in the hope that it will be useful,
Packit b040ce
# but WITHOUT ANY WARRANTY expressed or implied, including the implied
Packit b040ce
# warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
Packit b040ce
# the GNU Lesser General Public License for more details.  You should have
Packit b040ce
# received a copy of the GNU Lesser General Public License along with this
Packit b040ce
# program; if not, write to the Free Software Foundation, Inc., 51 Franklin
Packit b040ce
# Street, Fifth Floor, Boston, MA 02110-1301, USA.  Any Red Hat trademarks
Packit b040ce
# that are incorporated in the source code or documentation are not subject
Packit b040ce
# to the GNU Lesser General Public License and may only be used or
Packit b040ce
# replicated with the express permission of Red Hat, Inc.
Packit b040ce
#
Packit b040ce
# Red Hat Author(s): David Shea <dshea@redhat.com>
Packit b040ce
Packit b040ce
def test_comment(poentry):
Packit b040ce
    # Single-character translatable strings (e.g., the 'c' of press c to
Packit b040ce
    # continue) need some additional context in order to make sense. Make
Packit b040ce
    # sure that they have it.
Packit b040ce
Packit b040ce
    if len(poentry.msgid) == 1 and not poentry.comment:
Packit b040ce
        raise AssertionError("Single-character string missing a comment.")