Implement Target.__eq__()

Needed for unit tests, but probably useful for other cases too.
This commit is contained in:
Mark McLoughlin 2013-06-10 12:04:13 +01:00
parent 79a10f26ee
commit 6929a72987
2 changed files with 19 additions and 0 deletions

View File

@ -77,6 +77,9 @@ class Target(object):
kwargs.setdefault('fanout', self.fanout)
return Target(**kwargs)
def __eq__(self, other):
return vars(self) == vars(other)
def __repr__(self):
attrs = []
for a in ['exchange', 'topic', 'namespace',

View File

@ -0,0 +1,16 @@
# Copyright 2013 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.