diff options
author | Eric Brown <browne@vmware.com> | 2015-12-08 00:01:37 -0800 |
---|---|---|
committer | Eric Brown <browne@vmware.com> | 2015-12-08 00:01:37 -0800 |
commit | 1ac2ffe01a4048a5b913493d569b36e103a1ba2e (patch) | |
tree | bb214a9b2f9d18d6a720078f08f471f9800719d7 /oslo_config/types.py | |
parent | 8cd41466d36a359482f6ed7cc0b1c919541f5461 (diff) | |
download | oslo-config-1ac2ffe01a4048a5b913493d569b36e103a1ba2e.tar.gz |
Test equality of types.String choices as a set
The equality of a String might return false if the choices value
is a List for one instance and Tuple for another. Also the order
can prevent a valid match. This patch normalizes the compare with
a set to ensure equality in those cases.
Change-Id: Ic5c36c390401c4cd60b1c5c46be93744b0025f06
Closes-Bug: #1523792
Diffstat (limited to 'oslo_config/types.py')
-rw-r--r-- | oslo_config/types.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/oslo_config/types.py b/oslo_config/types.py index a126681..338239b 100644 --- a/oslo_config/types.py +++ b/oslo_config/types.py @@ -165,7 +165,9 @@ class String(ConfigType): def __eq__(self, other): return ( (self.__class__ == other.__class__) and - (self.choices == other.choices) and + (set(self.choices) == set(other.choices) if + self.choices and other.choices else + self.choices == other.choices) and (self.quotes == other.quotes) and (self.regex == other.regex) ) |