diff options
author | W. Trevor King <wking@tremily.us> | 2012-11-11 20:35:08 -0500 |
---|---|---|
committer | W. Trevor King <wking@tremily.us> | 2012-11-11 20:35:08 -0500 |
commit | 88ac4e9030ab5827d1ab4d01ee6c0aff85184d28 (patch) | |
tree | 81d38d8e1a950ecc36001ab6fc76de8dfa776a67 /pym/gentoolkit/keyword.py | |
parent | keyword: remove shebang from module without __name__ == '__main__' block (diff) | |
download | gentoolkit-88ac4e9030ab5827d1ab4d01ee6c0aff85184d28.tar.gz gentoolkit-88ac4e9030ab5827d1ab4d01ee6c0aff85184d28.tar.bz2 gentoolkit-88ac4e9030ab5827d1ab4d01ee6c0aff85184d28.zip |
keyword: use Python 2/3-agnostic set notation in reduce_keywords doctest
Python 2.7 prints sets as "set([1, 2])", but Python 3.2 prints them as
"{1, 2}". Avoid having to chose by showing that the result of
reduce_keywords() is a set, and then printing the elements in a list.
Diffstat (limited to 'pym/gentoolkit/keyword.py')
-rw-r--r-- | pym/gentoolkit/keyword.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/pym/gentoolkit/keyword.py b/pym/gentoolkit/keyword.py index 17b3472..a234116 100644 --- a/pym/gentoolkit/keyword.py +++ b/pym/gentoolkit/keyword.py @@ -95,8 +95,11 @@ def reduce_keywords(keywords): """Reduce a list of keywords to a unique set of stable keywords. Example usage: - >>> reduce_keywords(['~amd64', 'x86', '~x86']) - set(['amd64', 'x86']) + >>> kw = reduce_keywords(['~amd64', 'x86', '~x86']) + >>> isinstance(kw, set) + True + >>> sorted(kw) + ['amd64', 'x86'] @type keywords: array @rtype: set |