8000 Allow Ref's to test equality against their data by phobologic · Pull Request #1048 · cloudtools/troposphere · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Allow Ref's to test equality against their data #1048

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 22, 2018
Merged

Conversation

phobologic
Copy link
Member

This is largely used by the Pseudo Parameters, so that these three
properties are all the same:

from troposphere import NoValue, Ref

s = "AWS::NoValue"
r = Ref(s)

s == r
s == NoValue
r == NoValue

This is in preparation for another PR to fix the validators for
mutually_exlusive and exactly_one - which should both allow
multiple values provided the values are set to AWS::NoValue

This is largely used by the Pseudo Parameters, so that these three
properties are all the same:

```
from troposphere import NoValue, Ref

s = "AWS::NoValue"
r = Ref(s)

s == r
s == NoValue
r == NoValue
```
@@ -322,6 +323,18 @@ def test_ref(self):
ref = t.to_dict()
self.assertEqual(ref['Ref'], 'param')

def test_ref_eq(self):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a test that also tests .ref() attribute?

@phobologic phobologic merged commit 661e68a into master May 22, 2018
@phobologic phobologic deleted the ref_equality branch May 22, 2018 23:38
@happyraul
Copy link
Contributor

Refs used to be hashable before this change. Now that a __eq__ method has been defined, they are no longer hashable. Should a __hash__ also be added to revert to the previous behavior?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0