Ejemplo n.º 1
0
    def test_initial_comments(self):
        result = config._preprocess('; foobar')
        self.assertEqual(result, '[__COMMENTS__]\n' '__SEMICOLON0__ = foobar')

        result = config._preprocess('# foobar')
        self.assertEqual(result, '[__COMMENTS__]\n' '__HASH0__ = foobar')

        result = config._preprocess('; foo\n# bar')
        self.assertEqual(
            result, '[__COMMENTS__]\n'
            '__SEMICOLON0__ = foo\n'
            '__HASH1__ = bar')
Ejemplo n.º 2
0
    def test_initial_comments(self):
        result = config._preprocess('; foobar')
        self.assertEqual(result, '[__COMMENTS__]\n'
                                 '__SEMICOLON0__ = foobar')

        result = config._preprocess('# foobar')
        self.assertEqual(result, '[__COMMENTS__]\n'
                                 '__HASH0__ = foobar')

        result = config._preprocess('; foo\n# bar')
        self.assertEqual(result, '[__COMMENTS__]\n'
                                 '__SEMICOLON0__ = foo\n'
                                 '__HASH1__ = bar')
Ejemplo n.º 3
0
 def test_section_extra_text_inline_semicolon(self):
     result = config._preprocess('[section] foobar ; baz')
     self.assertEqual(
         result, '[__COMMENTS__]\n'
         '[section]\n'
         '__SECTION0__ = foobar\n'
         '__INLINE1__ = baz')
Ejemplo n.º 4
0
 def test_inline_semicolon_comment(self):
     result = config._preprocess('[section]\nfoo = bar ; baz')
     self.assertEqual(
         result, '[__COMMENTS__]\n'
         '[section]\n'
         'foo = bar\n'
         '__INLINE0__ = baz')
Ejemplo n.º 5
0
 def test_initial_comment_inline_handling(self):
     result = config._preprocess('; foo ; bar ; baz')
     self.assertEqual(
         result, '[__COMMENTS__]\n'
         '__SEMICOLON0__ = foo\n'
         '__INLINE1__ = bar\n'
         '__INLINE2__ = baz')
Ejemplo n.º 6
0
 def test_section_extra_text_inline_semicolon(self):
     result = config._preprocess('[section] foobar ; baz')
     self.assertEqual(result, '[__COMMENTS__]\n'
                              '[section]\n'
                              '__SECTION0__ = foobar\n'
                              '__INLINE1__ = baz')
Ejemplo n.º 7
0
 def test_section_extra_text(self):
     result = config._preprocess('[section] foobar')
     self.assertEqual(result, '[__COMMENTS__]\n'
                              '[section]\n'
                              '__SECTION0__ = foobar')
Ejemplo n.º 8
0
 def test_inline_semicolon_comment(self):
     result = config._preprocess('[section]\nfoo = bar ; baz')
     self.assertEqual(result, '[__COMMENTS__]\n'
                              '[section]\n'
                              'foo = bar\n'
                              '__INLINE0__ = baz')
Ejemplo n.º 9
0
 def test_initial_comment_inline_handling(self):
     result = config._preprocess('; foo ; bar ; baz')
     self.assertEqual(result, '[__COMMENTS__]\n'
                              '__SEMICOLON0__ = foo\n'
                              '__INLINE1__ = bar\n'
                              '__INLINE2__ = baz')
Ejemplo n.º 10
0
 def test_plain_section(self):
     result = config._preprocess('[section]\nfoo = bar')
     self.assertEqual(result, '[__COMMENTS__]\n'
                              '[section]\n'
                              'foo = bar')
Ejemplo n.º 11
0
 def test_plain_section(self):
     result = config._preprocess('[section]\nfoo = bar')
     self.assertEqual(result, '[__COMMENTS__]\n' '[section]\n' 'foo = bar')
Ejemplo n.º 12
0
 def test_no_inline_hash_comment(self):
     result = config._preprocess('[section]\nfoo = bar # baz')
     self.assertEqual(result, '[__COMMENTS__]\n'
                      '[section]\n'
                      'foo = bar # baz')
Ejemplo n.º 13
0
 def test_conversion(self):
     """Tests all of the above cases at once."""
     result = config._preprocess(INPUT_CONFIG)
     self.assertEqual(result, PROCESSED_CONFIG)
Ejemplo n.º 14
0
 def test_section_extra_text(self):
     result = config._preprocess('[section] foobar')
     self.assertEqual(
         result, '[__COMMENTS__]\n'
         '[section]\n'
         '__SECTION0__ = foobar')
Ejemplo n.º 15
0
 def test_conversion(self):
     """Tests all of the above cases at once."""
     result = config._preprocess(INPUT_CONFIG)
     self.assertEqual(result, PROCESSED_CONFIG)
Ejemplo n.º 16
0
 def test_empty_config(self):
     result = config._preprocess('')
     self.assertEqual(result, '[__COMMENTS__]')
Ejemplo n.º 17
0
 def test_no_inline_hash_comment(self):
     result = config._preprocess('[section]\nfoo = bar # baz')
     self.assertEqual(result, '[__COMMENTS__]\n'
                              '[section]\n'
                              'foo = bar # baz')
Ejemplo n.º 18
0
 def test_empty_config(self):
     result = config._preprocess('')
     self.assertEqual(result, '[__COMMENTS__]')