[pypy-commit] pypy py3k: merge upstream
Manuel Jacob
noreply at buildbot.pypy.org
Wed Feb 13 22:25:04 CET 2013
Author: Manuel Jacob
Branch: py3k
Changeset: r61202:be9716c1d767
Date: 2013-02-13 11:44 +0100
http://bitbucket.org/pypy/pypy/changeset/be9716c1d767/
Log: merge upstream
diff --git a/pypy/interpreter/astcompiler/test/test_compiler.py b/pypy/interpreter/astcompiler/test/test_compiler.py
--- a/pypy/interpreter/astcompiler/test/test_compiler.py
+++ b/pypy/interpreter/astcompiler/test/test_compiler.py
@@ -668,8 +668,8 @@
#cmp
self.assert_(p == p)
self.assert_(d == d)
- self.assert_(p < d)
- self.assert_(d > p)
+ self.failUnlessRaises(TypeError, lambda: p < d)
+ self.failUnlessRaises(TypeError, lambda: d > p)
#__non__zero__
if p: self.fail("Empty mapping must compare to False")
if not d: self.fail("Full mapping must compare to True")
diff --git a/pypy/module/imp/test/test_import.py b/pypy/module/imp/test/test_import.py
--- a/pypy/module/imp/test/test_import.py
+++ b/pypy/module/imp/test/test_import.py
@@ -1094,12 +1094,6 @@
(mydir):
import sys
sys.path.append(mydir)
-
- # Obscure: manually bootstrap the utf-8 codec for
- # TextIOs opened by imp.find_module. It's not otherwise
- # loaded by the test infrastructure but would have been
- # in any other situation
- import encodings.utf_8
""")
def teardown_class(cls):
diff --git a/pypy/objspace/std/dictmultiobject.py b/pypy/objspace/std/dictmultiobject.py
--- a/pypy/objspace/std/dictmultiobject.py
+++ b/pypy/objspace/std/dictmultiobject.py
@@ -862,49 +862,6 @@
return space.w_False
return space.w_True
-def characterize(space, w_a, w_b):
- """ (similar to CPython)
- returns the smallest key in acontent for which b's value is different or absent and this value """
- w_smallest_diff_a_key = None
- w_its_value = None
- iteratorimplementation = w_a.iteritems()
- while 1:
- w_key, w_val = iteratorimplementation.next_item()
- if w_key is None:
- break
- if w_smallest_diff_a_key is None or space.is_true(space.lt(w_key, w_smallest_diff_a_key)):
- w_bvalue = w_b.getitem(w_key)
- if w_bvalue is None:
- w_its_value = w_val
- w_smallest_diff_a_key = w_key
- else:
- if not space.eq_w(w_val, w_bvalue):
- w_its_value = w_val
- w_smallest_diff_a_key = w_key
- return w_smallest_diff_a_key, w_its_value
-
-def lt__DictMulti_DictMulti(space, w_left, w_right):
- # Different sizes, no problem
- if w_left.length() < w_right.length():
- return space.w_True
- if w_left.length() > w_right.length():
- return space.w_False
-
- # Same size
- w_leftdiff, w_leftval = characterize(space, w_left, w_right)
- if w_leftdiff is None:
- return space.w_False
- w_rightdiff, w_rightval = characterize(space, w_right, w_left)
- if w_rightdiff is None:
- # w_leftdiff is not None, w_rightdiff is None
- return space.w_True
- w_res = space.lt(w_leftdiff, w_rightdiff)
- if (not space.is_true(w_res) and
- space.eq_w(w_leftdiff, w_rightdiff) and
- w_rightval is not None):
- w_res = space.lt(w_leftval, w_rightval)
- return w_res
-
def dict_copy__DictMulti(space, w_self):
w_new = W_DictMultiObject.allocate_and_init_instance(space)
update1_dict_dict(space, w_new, w_self)
diff --git a/pypy/objspace/std/test/test_dictmultiobject.py b/pypy/objspace/std/test/test_dictmultiobject.py
--- a/pypy/objspace/std/test/test_dictmultiobject.py
+++ b/pypy/objspace/std/test/test_dictmultiobject.py
@@ -387,27 +387,13 @@
bool = d1 != d3
assert bool == True
- def test_lt(self):
+ def test_richcompare(self):
+ import operator
d1 = {1: 2, 3: 4}
- d2 = {1: 2, 3: 4}
- d3 = {1: 2, 3: 5}
- d4 = {1: 2}
- bool = d1 < d2
- assert bool == False
- bool = d1 < d3
- assert bool == True
- bool = d1 < d4
- assert bool == False
-
- def test_lt2(self):
- assert {'a': 1 } < { 'a': 2 }
- assert not {'a': 1 } > { 'a': 2 }
- assert not {'a': 1, 'b': 0 } > { 'a': 2, 'b': 0 }
- assert {'a': 1, 'b': 0 } < { 'a': 2, 'b': 0 }
- assert {'a': 1, 'b': 0 } < { 'a': 1, 'b': 2 }
- assert not {'a': 1, 'b': 0 } < { 'a': 1, 'b': -2 }
- assert {'a': 1 } < { 'b': 1}
- assert {'a': 1, 'x': 2 } < { 'b': 1, 'x': 2}
+ d2 = {1: 2, 3: 5}
+ for op in 'lt', 'le', 'gt', 'ge':
+ f = getattr(operator, op)
+ raises(TypeError, f, d1, d2)
def test_str_repr(self):
assert '{}' == str({})
diff --git a/pypy/tool/pytest/run-script/regrverbose.py b/pypy/tool/pytest/run-script/regrverbose.py
--- a/pypy/tool/pytest/run-script/regrverbose.py
+++ b/pypy/tool/pytest/run-script/regrverbose.py
@@ -8,10 +8,10 @@
modname = sys.argv[0]
impname = 'test.' + modname
try:
+ regrtest.replace_stdout()
mod = __import__(impname, globals(), locals(), [modname])
indirect_test = getattr(mod, 'test_main', None)
if indirect_test is not None:
- regrtest.replace_stdout()
indirect_test()
except unittest.SkipTest:
sys.stderr.write("="*26 + "skipped" + "="*26 + "\n")
More information about the pypy-commit
mailing list