コード例 #1
0
 def test_fill_missing_marked(self):
     command = CommandFiller(
         'abc {/name/@text} ef [name {/names/@text}] and {/age/@text}')
     inputValues = dict([('/name/@text', 'Mix')])
     actual = command.fill_values(inputValues)
     expected = 'abc Mix ef [name {}] and {}'.format(
         MISSING_VALUE_TEMPLATE, MISSING_VALUE_TEMPLATE)
     self.assertEqual(expected, actual)
コード例 #2
0
 def test_fill_multiple_missing_not_replaced(self):
     command = CommandFiller(
         'abc {/name/@text} {/namesurname/@text} ef {name-surname/@text} {/names/@text}'
     )
     inputValues = dict([('/namesurname/@text', 'mair'),
                         ('/names/@text', 'theo')])
     actual = command.fill_values(inputValues)
     expected = 'abc {} mair ef {} theo'.format(MISSING_VALUE_TEMPLATE,
                                                MISSING_VALUE_TEMPLATE)
     self.assertEqual(expected, actual)
コード例 #3
0
 def test_fill_optionals_refs(self):
     command = CommandFiller(
         'abc [{/name/@text}] [whose surname is {/namesurname/@text},]' +
         ' ef [{name-surname/@text}, initials {/names/@text}]')
     inputValues = dict([('/name/@text', 'Mix'),
                         ('/namesurname/@text', 'mair'),
                         ('name-surname/@text', 'MM'),
                         ('/names/@text', 'theo')])
     actual = command.fill_values(inputValues)
     expected = 'abc [Mix] [whose surname is mair,] ef [MM, initials theo]'
     self.assertEqual(expected, actual)
コード例 #4
0
 def test_fill_simple(self):
     command = CommandFiller('abc {/name/@text} ef')
     inputValues = dict([('/name/@text', 'Mix')])
     actual = command.fill_values(inputValues)
     expected = 'abc Mix ef'
     self.assertEqual(expected, actual)