Author: Carl Friedrich Bolz <cfb...@gmx.de> Branch: dict-strategies Changeset: r45246:7ab27311fa65 Date: 2011-07-01 22:41 +0200 http://bitbucket.org/pypy/pypy/changeset/7ab27311fa65/
Log: this test is passing on trunk completely by chance. make it more robust diff --git a/pypy/module/pypyjit/test_pypy_c/test_call.py b/pypy/module/pypyjit/test_pypy_c/test_call.py --- a/pypy/module/pypyjit/test_pypy_c/test_call.py +++ b/pypy/module/pypyjit/test_pypy_c/test_call.py @@ -209,6 +209,26 @@ i16 = force_token() """) + def test_kwargs_empty(self): + def main(x): + def g(**args): + return len(args) + 1 + # + s = 0 + d = {} + i = 0 + while i < x: + s += g(**d) # ID: call + i += 1 + return s + # + log = self.run(main, [1000]) + assert log.result == 1000 + loop, = log.loops_by_id('call') + ops = log.opnames(loop.ops_by_id('call')) + guards = [ops for ops in ops if ops.startswith('guard')] + assert guards == ["guard_no_overflow"] + def test_kwargs(self): # this is not a very precise test, could be improved def main(x): @@ -216,20 +236,24 @@ return len(args) # s = 0 - d = {} - for i in range(x): + d = {"a": 1} + i = 0 + while i < x: s += g(**d) # ID: call d[str(i)] = i if i % 100 == 99: - d = {} + d = {"a": 1} + i += 1 return s # log = self.run(main, [1000]) - assert log.result == 49500 + assert log.result == 50500 loop, = log.loops_by_id('call') + print loop.ops_by_id('call') ops = log.opnames(loop.ops_by_id('call')) guards = [ops for ops in ops if ops.startswith('guard')] - assert len(guards) <= 5 + print guards + assert len(guards) <= 20 def test_stararg_virtual(self): def main(x): _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit