Пример #1
0
    def testAddFooter(self):
        self.assertEqual(git_footers.add_footer('', 'Key', 'Value'),
                         '\nKey: Value')

        self.assertEqual(
            git_footers.add_footer('Header with empty line.\n\n', 'Key',
                                   'Value'),
            'Header with empty line.\n\nKey: Value')

        self.assertEqual(
            git_footers.add_footer('Top\n\nSome: footer', 'Key', 'value'),
            'Top\n\nSome: footer\nKey: value')

        self.assertEqual(
            git_footers.add_footer('Top\n\nSome: footer',
                                   'Key',
                                   'value',
                                   after_keys=['Any']),
            'Top\n\nSome: footer\nKey: value')

        self.assertEqual(
            git_footers.add_footer('Top\n\nSome: footer',
                                   'Key',
                                   'value',
                                   after_keys=['Some']),
            'Top\n\nSome: footer\nKey: value')

        self.assertEqual(
            git_footers.add_footer('Top\n\nSome: footer\nOther: footer',
                                   'Key',
                                   'value',
                                   after_keys=['Some']),
            'Top\n\nSome: footer\nKey: value\nOther: footer')

        self.assertEqual(
            git_footers.add_footer('Top\n\nSome: footer\nOther: footer',
                                   'Key',
                                   'value',
                                   before_keys=['Other']),
            'Top\n\nSome: footer\nKey: value\nOther: footer')

        self.assertEqual(
            git_footers.add_footer(
                'Top\n\nSome: footer\nOther: footer\nFinal: footer',
                'Key',
                'value',
                after_keys=['Some'],
                before_keys=['Final']),
            'Top\n\nSome: footer\nKey: value\nOther: footer\nFinal: footer')

        self.assertEqual(
            git_footers.add_footer(
                'Top\n\nSome: footer\nOther: footer\nFinal: footer',
                'Key',
                'value',
                after_keys=['Other'],
                before_keys=['Some']),
            'Top\n\nSome: footer\nOther: footer\nKey: value\nFinal: footer')
Пример #2
0
  def testAddFooter(self):
    self.assertEqual(
        git_footers.add_footer('', 'Key', 'Value'),
        '\nKey: Value')
    self.assertEqual(
        git_footers.add_footer('Header with empty line.\n\n', 'Key', 'Value'),
        'Header with empty line.\n\nKey: Value')

    self.assertEqual(
        git_footers.add_footer('Top\n\nSome: footer', 'Key', 'value'),
        'Top\n\nSome: footer\nKey: value')

    self.assertEqual(
        git_footers.add_footer('Top\n\nSome: footer', 'Key', 'value',
                               after_keys=['Any']),
        'Top\n\nKey: value\nSome: footer')

    self.assertEqual(
        git_footers.add_footer('Top\n\nSome: footer', 'Key', 'value',
                               after_keys=['Some']),
        'Top\n\nSome: footer\nKey: value')

    self.assertEqual(
         git_footers.add_footer('Top\n\nSome: footer\nOther: footer',
                                'Key', 'value', after_keys=['Some']),
         'Top\n\nSome: footer\nKey: value\nOther: footer')