Exemplo n.º 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)
Exemplo n.º 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')
Exemplo n.º 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(
Exemplo n.º 4
0
from exactly_lib.util.str_ import name

DESCRIPTION_DELIMITER = '`'

DESCRIPTION_DELIMITER_CHAR_NAME = name.NameWithGenderWithFormatting(
    name.a_name(name.name_with_plural_s('backtick')))
END_OF_FILE = 'END-OF-FILE'
END_OF_LINE = 'END-OF-LINE'

INSTRUCTION = name.NameWithGenderWithFormatting(
    name.an_name(name.name_with_plural_s('instruction')))

INSTRUCTION_DESCRIPTION = name.NameWithGenderWithFormatting(
    name.an_name(name.name_with_plural_s('instruction description')))


def format_constant(constant: str) -> str:
    return '"' + constant + '"'
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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, '')
Exemplo n.º 8
0
from exactly_lib.util.str_ import name

INTEGER_MATCHER_MODEL = name.NameWithGenderWithFormatting(
    name.an_name_with_plural_s('integer'))
LINE_MATCHER_MODEL = name.NameWithGenderWithFormatting(
    name.a_name_with_plural_s('line'))
FILE_MATCHER_MODEL = name.NameWithGenderWithFormatting(
    name.a_name_with_plural_s('file'))
TEXT_MODEL = name.NameWithGenderWithFormatting(
    name.a_name_with_plural_s('text'))
FILES_MATCHER_MODEL = name.NameWithGenderWithFormatting(
    name.a_name(name.Name('set of files', 'sets of files')))