def test_initial_comments(self): result = config._postprocess('[__COMMENTS__]\n' '__SEMICOLON0__ = foobar') self.assertEqual(result, '; foobar') result = config._postprocess('[__COMMENTS__]\n' '__HASH0__ = foobar') self.assertEqual(result, '# foobar') result = config._postprocess('[__COMMENTS__]\n' '__SEMICOLON0__ = foo\n' '__HASH1__ = bar') self.assertEqual(result, '; foo\n# bar')
def test_conversion(self): result = config._postprocess(PROCESSED_CONFIG) self.assertEqual(result, INPUT_CONFIG)
def test_section_extra_text_inline_semicolon(self): result = config._postprocess('[__COMMENTS__]\n' '[section]\n' '__SECTION0__ = foobar\n' '__INLINE1__ = baz') self.assertEqual(result, '[section] foobar ; baz')
def test_section_extra_text(self): result = config._postprocess('[__COMMENTS__]\n' '[section]\n' '__SECTION0__ = foobar') self.assertEqual(result, '[section] foobar')
def test_inline_semicolon_comment(self): result = config._postprocess('[__COMMENTS__]\n' '[section]\n' 'foo = bar\n' '__INLINE0__ = baz') self.assertEqual(result, '[section]\nfoo = bar ; baz')
def test_initial_comment_inline_handling(self): result = config._postprocess('[__COMMENTS__]\n' '__SEMICOLON0__ = foo\n' '__INLINE1__ = bar\n' '__INLINE2__ = baz') self.assertEqual(result, '; foo ; bar ; baz')
def test_plain_section(self): result = config._postprocess('[__COMMENTS__]\n' '[section]\n' 'foo = bar') self.assertEqual(result, '[section]\nfoo = bar')
def test_empty_config(self): result = config._postprocess('[__COMMENTS__]') self.assertEqual(result, '')