Author: Manuel Jacob
Branch: py3k
Changeset: r61364:90dd1dec9cba
Date: 2013-02-16 17:55 +0100
http://bitbucket.org/pypy/pypy/changeset/90dd1dec9cba/

Log:    Fix TestPartial.test_repr().

diff --git a/lib_pypy/_functools.py b/lib_pypy/_functools.py
--- a/lib_pypy/_functools.py
+++ b/lib_pypy/_functools.py
@@ -40,3 +40,17 @@
         if self.keywords is not None:
             fkeywords = dict(self.keywords, **fkeywords)
         return self.func(*(self.args + fargs), **fkeywords)
+
+    def __repr__(self):
+        cls = type(self)
+        if cls is partial:
+            name = 'functools.partial'
+        else:
+            name = cls.__name__
+        tmp = [repr(self.func)]
+        for arg in self.args:
+            tmp.append(repr(arg))
+        if self.keywords:
+            for k, v in self.keywords.items():
+                tmp.append("{}={!r}".format(k, v))
+        return "{}({})".format(name, ', '.join(tmp))
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to