Mercurial > python-hglib
diff tests/test-config.py @ 143:4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
author | Brett Cannon <brett@python.org> |
---|---|
date | Mon, 09 Mar 2015 18:26:25 -0400 |
parents | 9ecb271600fc |
children | c1b966866ed7 |
line wrap: on
line diff
--- a/tests/test-config.py Sun Mar 08 13:08:37 2015 -0400 +++ b/tests/test-config.py Mon Mar 09 18:26:25 2015 -0400 @@ -1,4 +1,5 @@ import os, common, hglib +from hglib.util import b class test_config(common.basetest): def setUp(self): @@ -11,23 +12,25 @@ def test_basic(self): config = self.client.config() - self.assertTrue(('section', 'key', 'value') in self.client.config()) + self.assertTrue( + (b('section'), b('key'), b('value')) in self.client.config()) - self.assertTrue([('section', 'key', 'value')], - self.client.config('section')) - self.assertTrue([('section', 'key', 'value')], - self.client.config(['section', 'foo'])) + self.assertTrue([(b('section'), b('key'), b('value'))], + self.client.config(b('section'))) + self.assertTrue([(b('section'), b('key'), b('value'))], + self.client.config([b('section'), b('foo')])) self.assertRaises(hglib.error.CommandError, - self.client.config, ['a.b', 'foo']) + self.client.config, [b('a.b'), b('foo')]) def test_show_source(self): config = self.client.config(showsource=True) - self.assertTrue((os.path.abspath('.hg/hgrc') + ':2', - 'section', 'key', 'value') in config) + self.assertTrue((os.path.abspath(b('.hg/hgrc')) + b(':2'), + b('section'), b('key'), b('value')) in config) class test_config_arguments(common.basetest): def test_basic(self): - client = hglib.open(configs=['diff.unified=5', 'a.b=foo']) - self.assertEqual(client.config('a'), [('a', 'b', 'foo')]) - self.assertEqual(client.config('diff'), [('diff', 'unified', '5')]) + client = hglib.open(configs=[b('diff.unified=5'), b('a.b=foo')]) + self.assertEqual(client.config(b('a')), [(b('a'), b('b'), b('foo'))]) + self.assertEqual(client.config(b('diff')), + [(b('diff'), b('unified'), b('5'))])