コード例 #1
0
 def test_denominator_word(self):
     name = sut.NameWithGenderWithFormatting(sut.NameWithGender(
         'a', 'name', 'names'),
                                             quoting_begin='<<',
                                             quoting_end='>>')
     self._check_with_flags(name, name.determinator_word,
                            SC.DETERMINATOR_WORD)
コード例 #2
0
    def test_get_parts(self):
        value = sut.NameWithGenderWithFormatting(
            sut.NameWithGender('det-word', 'sing', 'the-plural'), '[', ']')

        self.assertEqual('det-word', value.determinator_word,
                         'determinator word')

        self.assertEqual('sing', value.singular, 'singular')

        self.assertEqual('the-plural', value.plural, 'plural')

        self.assertEqual('[', value.quoting_begin, 'quoting_begin')

        self.assertEqual(']', value.quoting_end, 'quoting_end')
コード例 #3
0
    def test_singular_determined(self):
        name = sut.NameWithGenderWithFormatting(sut.NameWithGender(
            'an', 'instruction name', 'instruction names'),
                                                quoting_begin='[',
                                                quoting_end=']')
        cases = [
            Case('flags: none',
                 '',
                 expected=' '.join([name.determinator_word, name.singular])),
            Case('flags: quoted',
                 SC.FLAG_SEPARATOR + SC.QUOTED_FLAG,
                 expected=' '.join([
                     name.determinator_word, ''.join(
                         [name.quoting_begin, name.singular, name.quoting_end])
                 ])),
            Case('flags:init_cap',
                 SC.FLAG_SEPARATOR + SC.INIT_CAP_FLAG,
                 expected=' '.join(
                     [name.determinator_word.capitalize(), name.singular])),
            Case('flags:upper',
                 SC.FLAG_SEPARATOR + SC.UPPER_CASE_FLAG,
                 expected=' '.join(
                     [name.determinator_word.upper(),
                      name.singular.upper()])),
            Case('flags:upper quoted',
                 SC.FLAG_SEPARATOR + SC.UPPER_CASE_FLAG + SC.QUOTED_FLAG,
                 expected=' '.join([
                     name.determinator_word.upper(), ''.join([
                         name.quoting_begin,
                         name.singular.upper(), name.quoting_end
                     ])
                 ])),
            Case('flags:quoted upper',
                 SC.FLAG_SEPARATOR + SC.QUOTED_FLAG + SC.UPPER_CASE_FLAG,
                 expected=' '.join([
                     name.determinator_word.upper(), ''.join([
                         name.quoting_begin,
                         name.singular.upper(), name.quoting_end
                     ])
                 ])),
        ]

        for case in cases:
            format_tail = ':' + SC.DETERMINED + case.format_string
            with self.subTest(name=case.name,
                              format_string=case.format_string,
                              format_tail=format_tail):
                string_to_format = '{{x{format_string}}}'.format(
コード例 #4
0
ファイル: file_types.py プロジェクト: emilkarlen/exactly
from exactly_lib.util.str_ import name
from exactly_lib.util.str_.name import NameWithGenderWithFormatting

REGULAR = NameWithGenderWithFormatting(name.a_name_with_plural_s('regular file'))

DIRECTORY = NameWithGenderWithFormatting(name.NameWithGender('a', 'directory', 'directories'))

SYM_LINK = NameWithGenderWithFormatting(name.a_name_with_plural_s('symbolic link'))
コード例 #5
0
 def test_plural(self):
     name = sut.NameWithGenderWithFormatting(sut.NameWithGender(
         'a', 'name', 'names'),
                                             quoting_begin='<<',
                                             quoting_end='>>')
     self._check_with_flags(name, name.plural, SC.PLURAL)
コード例 #6
0
 def test_explicit_singular_spec_SHOULD_be_singular(self):
     name = sut.NameWithGenderWithFormatting(sut.NameWithGender(
         'a', 'name', 'names'),
                                             quoting_begin='<<',
                                             quoting_end='>>')
     self._check_with_flags(name, name.singular, SC.SINGULAR)
コード例 #7
0
 def test_default_SHOULD_be_singular(self):
     name = sut.NameWithGenderWithFormatting(sut.NameWithGender(
         'a', 'name', 'names'),
                                             quoting_begin='<<',
                                             quoting_end='>>')
     self._check_with_flags(name, name.singular, '')