pypy / pypy / module / micronumpy / test /

from pypy.conftest import gettestobjspace
from pypy.module.micronumpy.interp_numarray import SingleDimArray, FloatWrapper

class BaseNumpyAppTest(object):
    def setup_class(cls): = gettestobjspace(usemodules=('micronumpy',))

class TestSignature(object):
    def test_binop_signature(self, space):
        ar = SingleDimArray(10)
        v1 = ar.descr_add(space, ar)
        v2 = ar.descr_add(space, FloatWrapper(2.0))
        assert v1.signature is not v2.signature
        v3 = ar.descr_add(space, FloatWrapper(1.0))
        assert v2.signature is v3.signature
        v4 = ar.descr_add(space, ar)
        assert v1.signature is v4.signature

    def test_slice_signature(self, space):
        ar = SingleDimArray(10)
        v1 = ar.descr_getitem(space, space.wrap(slice(1, 5, 1)))
        v2 = ar.descr_getitem(space, space.wrap(slice(4, 6, 1)))
        assert v1.signature is v2.signature

        v3 = ar.descr_add(space, v1)
        v4 = ar.descr_add(space, v2)
        assert v3.signature is v4.signature
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.