~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_config.py

  • Committer: Aaron Bentley
  • Date: 2008-03-03 16:52:41 UTC
  • mfrom: (3144.3.11 fix-conflict-handling)
  • mto: This revision was merged to the branch mainline in revision 3250.
  • Revision ID: aaron@aaronbentley.com-20080303165241-0k2c7ggs6kr9q6hf
Merge with fix-conflict-handling

Show diffs side-by-side

added added

removed removed

Lines of Context:
205
205
 
206
206
 
207
207
class TestConfigObj(tests.TestCase):
 
208
 
208
209
    def test_get_bool(self):
209
210
        co = config.ConfigObj(StringIO(bool_config))
210
211
        self.assertIs(co.get_bool('DEFAULT', 'active'), True)
212
213
        self.assertIs(co.get_bool('UPPERCASE', 'active'), True)
213
214
        self.assertIs(co.get_bool('UPPERCASE', 'nonactive'), False)
214
215
 
 
216
    def test_hash_sign_in_value(self):
 
217
        """
 
218
        Before 4.5.0, ConfigObj did not quote # signs in values, so they'd be
 
219
        treated as comments when read in again. (#86838)
 
220
        """
 
221
        co = config.ConfigObj()
 
222
        co['test'] = 'foo#bar'
 
223
        lines = co.write()
 
224
        self.assertEqual(lines, ['test = "foo#bar"'])
 
225
        co2 = config.ConfigObj(lines)
 
226
        self.assertEqual(co2['test'], 'foo#bar')
 
227
 
215
228
 
216
229
erroneous_config = """[section] # line 1
217
230
good=good # line 2
425
438
        self.check_file_contents(locations,
426
439
                                 '[%s/branch]\n'
427
440
                                 'push_location = http://foobar\n'
428
 
                                 'push_location:policy = norecurse'
 
441
                                 'push_location:policy = norecurse\n'
429
442
                                 % (local_path,))
430
443
 
431
444
    def test_autonick_urlencoded(self):
897
910
        self.my_config.set_user_option('foo', 'bar')
898
911
        self.assertEqual(
899
912
            self.my_config.branch.control_files.files['branch.conf'],
900
 
            'foo = bar')
 
913
            'foo = bar\n')
901
914
        self.assertEqual(self.my_config.get_user_option('foo'), 'bar')
902
915
        self.my_config.set_user_option('foo', 'baz',
903
916
                                       store=config.STORE_LOCATION)