Exemple #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')
Exemple #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')
Exemple #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')
Exemple #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')
Exemple #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')
Exemple #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')
Exemple #7
0
 def test_section_extra_text(self):
     result = config._preprocess('[section] foobar')
     self.assertEqual(result, '[__COMMENTS__]\n'
                              '[section]\n'
                              '__SECTION0__ = foobar')
Exemple #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')
Exemple #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')
Exemple #10
0
 def test_plain_section(self):
     result = config._preprocess('[section]\nfoo = bar')
     self.assertEqual(result, '[__COMMENTS__]\n'
                              '[section]\n'
                              'foo = bar')
Exemple #11
0
 def test_plain_section(self):
     result = config._preprocess('[section]\nfoo = bar')
     self.assertEqual(result, '[__COMMENTS__]\n' '[section]\n' 'foo = bar')
Exemple #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')
Exemple #13
0
 def test_conversion(self):
     """Tests all of the above cases at once."""
     result = config._preprocess(INPUT_CONFIG)
     self.assertEqual(result, PROCESSED_CONFIG)
Exemple #14
0
 def test_section_extra_text(self):
     result = config._preprocess('[section] foobar')
     self.assertEqual(
         result, '[__COMMENTS__]\n'
         '[section]\n'
         '__SECTION0__ = foobar')
Exemple #15
0
 def test_conversion(self):
     """Tests all of the above cases at once."""
     result = config._preprocess(INPUT_CONFIG)
     self.assertEqual(result, PROCESSED_CONFIG)
Exemple #16
0
 def test_empty_config(self):
     result = config._preprocess('')
     self.assertEqual(result, '[__COMMENTS__]')
Exemple #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')
Exemple #18
0
 def test_empty_config(self):
     result = config._preprocess('')
     self.assertEqual(result, '[__COMMENTS__]')