Skip to content

Commit

Permalink
Merge pull request #177 from zopefoundation/fix-signature
Browse files Browse the repository at this point in the history
Fix repr of "Attribute" to look like before
  • Loading branch information
jensens authored Feb 16, 2020
2 parents 0e32e11 + 823faaa commit 7f6f60e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@
Like the above, this will break consumers depending on the exact
output of error messages if more than one error is present.


4.7.1 (2019-11-11)
==================

Expand Down
2 changes: 1 addition & 1 deletion src/zope/interface/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ def __str__(self):
return of + self.__name__ + self._get_str_info()

def __repr__(self):
return "<%s.%s at 0x%x %s>" % (
return "<%s.%s object at 0x%x %s>" % (
type(self).__module__,
type(self).__name__,
id(self),
Expand Down
8 changes: 4 additions & 4 deletions src/zope/interface/tests/test_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -1910,13 +1910,13 @@ def test__repr__w_interface(self):
method = self._makeOne()
method.interface = type(self)
r = repr(method)
self.assertTrue(r.startswith('<zope.interface.interface.Attribute at'), r)
self.assertTrue(r.startswith('<zope.interface.interface.Attribute object at'), r)
self.assertTrue(r.endswith(' AttributeTests.TestAttribute>'), r)

def test__repr__wo_interface(self):
method = self._makeOne()
r = repr(method)
self.assertTrue(r.startswith('<zope.interface.interface.Attribute at'), r)
self.assertTrue(r.startswith('<zope.interface.interface.Attribute object at'), r)
self.assertTrue(r.endswith(' TestAttribute>'), r)

def test__str__w_interface(self):
Expand Down Expand Up @@ -1997,14 +1997,14 @@ def test__repr__w_interface(self):
method.kwargs = 'kw'
method.interface = type(self)
r = repr(method)
self.assertTrue(r.startswith('<zope.interface.interface.Method at'), r)
self.assertTrue(r.startswith('<zope.interface.interface.Method object at'), r)
self.assertTrue(r.endswith(' MethodTests.TestMethod(**kw)>'), r)

def test__repr__wo_interface(self):
method = self._makeOne()
method.kwargs = 'kw'
r = repr(method)
self.assertTrue(r.startswith('<zope.interface.interface.Method at'), r)
self.assertTrue(r.startswith('<zope.interface.interface.Method object at'), r)
self.assertTrue(r.endswith(' TestMethod(**kw)>'), r)

def test__str__w_interface(self):
Expand Down

0 comments on commit 7f6f60e

Please sign in to comment.