Author: Philip Jenvey <[email protected]>
Branch: py3k
Changeset: r53339:63939a106a47
Date: 2012-03-12 12:34 -0700
http://bitbucket.org/pypy/pypy/changeset/63939a106a47/
Log: unapply apply
diff --git a/pypy/module/__builtin__/__init__.py
b/pypy/module/__builtin__/__init__.py
--- a/pypy/module/__builtin__/__init__.py
+++ b/pypy/module/__builtin__/__init__.py
@@ -15,7 +15,6 @@
'input' : 'app_io.input',
'print' : 'app_io.print_',
- 'apply' : 'app_functional.apply',
'sorted' : 'app_functional.sorted',
'any' : 'app_functional.any',
'all' : 'app_functional.all',
diff --git a/pypy/module/__builtin__/app_functional.py
b/pypy/module/__builtin__/app_functional.py
--- a/pypy/module/__builtin__/app_functional.py
+++ b/pypy/module/__builtin__/app_functional.py
@@ -5,12 +5,6 @@
# ____________________________________________________________
-def apply(function, args=(), kwds={}):
- """call a function (or other callable object) and return its result"""
- return function(*args, **kwds)
-
-# ____________________________________________________________
-
def sorted(lst, key=None, reverse=None):
"sorted(iterable, key=None, reverse=False) --> new sorted list"
sorted_lst = list(lst)
diff --git a/pypy/module/__builtin__/test/test_apply.py
b/pypy/module/__builtin__/test/test_apply.py
deleted file mode 100644
--- a/pypy/module/__builtin__/test/test_apply.py
+++ /dev/null
@@ -1,27 +0,0 @@
-import autopath
-
-
-# This is a very trivial series of tests. If apply is subtlely broken,
-# we will have to find out some other way.
-
-class AppTestApply:
-
- def test_trivial_listonly(self):
- def mymin(*args):
- return min(list(args))
-
- assert apply(mymin, [-1,-2,-3,-4]) == -4
-
- def test_trivial_dictonly(self):
- def mymin(*arr, **kwargs):
- return min(list(arr) + kwargs.values())
- assert apply(mymin,
- [], {'null' : 0, 'one': 1, 'two' : 2}) == (
- 0)
- def test_trivial(self):
- def mymin(*arr, **kwargs):
- return min(list(arr) + kwargs.values())
- assert apply(mymin,
- [-1,-2,-3,-4],
- {'null' : 0, 'one': 1, 'two' : 2}) == (
- (-4))
diff --git a/pypy/module/__builtin__/test/test_functional.py
b/pypy/module/__builtin__/test/test_functional.py
--- a/pypy/module/__builtin__/test/test_functional.py
+++ b/pypy/module/__builtin__/test/test_functional.py
@@ -171,16 +171,6 @@
assert list(reversed(list(reversed("hello")))) == ['h','e','l','l','o']
raises(TypeError, reversed, reversed("hello"))
-class AppTestApply:
- def test_apply(self):
- def f(*args, **kw):
- return args, kw
- args = (1,3)
- kw = {'a': 1, 'b': 4}
- assert apply(f) == ((), {})
- assert apply(f, args) == (args, {})
- assert apply(f, args, kw) == (args, kw)
-
class AppTestAllAny:
"""
These are copied directly and replicated from the Python 2.5 source code.
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit