Commit 7ebb45c7e2e1b8355ec4802e0802ae7b383a6ea5

Authored by Simon Glass
1 parent b644c66f69

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>

Showing 1 changed file with 8 additions and 8 deletions Side-by-side Diff

tools/patman/settings.py
... ... @@ -58,26 +58,26 @@
58 58 # Check to make sure that bogus project gets general alias.
59 59 >>> config = _ProjectConfigParser("zzz")
60 60 >>> config.readfp(StringIO(sample_config))
61   - >>> config.get("alias", "enemies")
62   - u'Evil <evil@example.com>'
  61 + >>> str(config.get("alias", "enemies"))
  62 + 'Evil <evil@example.com>'
63 63  
64 64 # Check to make sure that alias gets overridden by project.
65 65 >>> config = _ProjectConfigParser("sm")
66 66 >>> config.readfp(StringIO(sample_config))
67   - >>> config.get("alias", "enemies")
68   - u'Green G. <ugly@example.com>'
  67 + >>> str(config.get("alias", "enemies"))
  68 + 'Green G. <ugly@example.com>'
69 69  
70 70 # Check to make sure that settings get merged with project.
71 71 >>> config = _ProjectConfigParser("linux")
72 72 >>> config.readfp(StringIO(sample_config))
73   - >>> sorted(config.items("settings"))
74   - [(u'am_hero', u'True'), (u'process_tags', u'False')]
  73 + >>> sorted((str(a), str(b)) for (a, b) in config.items("settings"))
  74 + [('am_hero', 'True'), ('process_tags', 'False')]
75 75  
76 76 # Check to make sure that settings works with unknown project.
77 77 >>> config = _ProjectConfigParser("unknown")
78 78 >>> config.readfp(StringIO(sample_config))
79   - >>> sorted(config.items("settings"))
80   - [(u'am_hero', u'True')]
  79 + >>> sorted((str(a), str(b)) for (a, b) in config.items("settings"))
  80 + [('am_hero', 'True')]
81 81 """
82 82 def __init__(self, project_name):
83 83 """Construct _ProjectConfigParser.