Author: Maciej Fijalkowski <fij...@gmail.com> Branch: Changeset: r76756:196823d2c4e7 Date: 2015-04-09 14:08 +0200 http://bitbucket.org/pypy/pypy/changeset/196823d2c4e7/
Log: merge diff --git a/rpython/rtyper/lltypesystem/test/test_lltype.py b/rpython/rtyper/lltypesystem/test/test_lltype.py --- a/rpython/rtyper/lltypesystem/test/test_lltype.py +++ b/rpython/rtyper/lltypesystem/test/test_lltype.py @@ -1,9 +1,11 @@ -from __future__ import with_statement import py +import sys from rpython.rtyper.lltypesystem.lltype import * from rpython.rtyper.lltypesystem import lltype, rffi from rpython.tool.identity_dict import identity_dict from rpython.tool import leakfinder +from rpython.annotator.annrpython import RPythonAnnotator +from rpython.rtyper.rtyper import RPythonTyper def isweak(p, T): try: @@ -539,6 +541,24 @@ assert S == Sprime +class Frozen(object): + def _freeze_(self): + return True + +@py.test.mark.parametrize('x', [ + 1, sys.maxint, 1.5, 'a', 'abc', u'abc', None, [], + py.test.mark.xfail(lambda: None), + {1.23: 'abc'}, + (1, 'x', [2, 3.],), + py.test.mark.xfail(Frozen()),]) +def test_typeOf_const(x): + a = RPythonAnnotator() + bk = a.bookkeeper + rtyper = RPythonTyper(a) + s_x = bk.immutablevalue(x) + r_x = rtyper.getrepr(s_x) + assert typeOf(r_x.convert_const(x)) == r_x.lowleveltype + def test_cast_primitive(): cases = [ (Float, 1, 1.0), _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit