From: W. Trevor King Date: Mon, 12 Nov 2012 01:35:08 +0000 (-0500) Subject: keyword: use Python 2/3-agnostic set notation in reduce_keywords doctest X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=88ac4e9030ab5827d1ab4d01ee6c0aff85184d28;p=gentoolkit.git 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. --- 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