diff options
author | Simon Glass <sjg@chromium.org> | 2019-05-14 15:53:52 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2019-07-10 16:52:58 -0600 |
commit | 7ebb45c7e2e1b8355ec4802e0802ae7b383a6ea5 (patch) | |
tree | d72134456fc20c46269c3dc14abd19fce1605e60 /tools/patman/settings.py | |
parent | b644c66f693c82750077b6f7530dde79f2ad7523 (diff) |
patman: Avoid unicode type in settings unit tests
The unicode type does not exist in Python 3 and when displaying strings
they do not have the 'u' prefix. Adjusts the settings unit tests to deal
with this difference, by converting the comparison value to a string, thus
dropping the 'u'.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/patman/settings.py')
-rw-r--r-- | tools/patman/settings.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/tools/patman/settings.py b/tools/patman/settings.py index b080136d88..c98911d522 100644 --- a/tools/patman/settings.py +++ b/tools/patman/settings.py @@ -58,26 +58,26 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser): # Check to make sure that bogus project gets general alias. >>> config = _ProjectConfigParser("zzz") >>> config.readfp(StringIO(sample_config)) - >>> config.get("alias", "enemies") - u'Evil <evil@example.com>' + >>> str(config.get("alias", "enemies")) + 'Evil <evil@example.com>' # Check to make sure that alias gets overridden by project. >>> config = _ProjectConfigParser("sm") >>> config.readfp(StringIO(sample_config)) - >>> config.get("alias", "enemies") - u'Green G. <ugly@example.com>' + >>> str(config.get("alias", "enemies")) + 'Green G. <ugly@example.com>' # Check to make sure that settings get merged with project. >>> config = _ProjectConfigParser("linux") >>> config.readfp(StringIO(sample_config)) - >>> sorted(config.items("settings")) - [(u'am_hero', u'True'), (u'process_tags', u'False')] + >>> sorted((str(a), str(b)) for (a, b) in config.items("settings")) + [('am_hero', 'True'), ('process_tags', 'False')] # Check to make sure that settings works with unknown project. >>> config = _ProjectConfigParser("unknown") >>> config.readfp(StringIO(sample_config)) - >>> sorted(config.items("settings")) - [(u'am_hero', u'True')] + >>> sorted((str(a), str(b)) for (a, b) in config.items("settings")) + [('am_hero', 'True')] """ def __init__(self, project_name): """Construct _ProjectConfigParser. |