Esempio n. 1
0
    def _test_generic_return_generic(self, method, pdf_method, mytype, arraytype, *args):
        a_result = method(*args)
        # flag = type(a_result) == mytype
        # assert(flag)
        if pdf_method:
            tmp = (a_result,) + args
            test2 = 0
            try:
                p = pdf_method(*tmp)
                test2 = 1
            finally:
                if test2 == 0:
                    print "called pdf method", pdf_method,
                    print "with args", tmp

            assert isfloat(p)

        tmp = args + (10,)
        da = method(*tmp)

        array_check(da, arraytype, (10,))
        if pdf_method:

            tmp = (da,) + args
            pa = pdf_method(*tmp)
            array_check(pa, Float, (10,))
Esempio n. 2
0
    def _test_generic_return_generic(self, method, pdf_method, mytype,
                                     arraytype, *args):
        a_result = method(*args)
        #flag = type(a_result) == mytype
        #assert(flag)
        if pdf_method:
            tmp = (a_result, ) + args
            test2 = 0
            try:
                p = pdf_method(*tmp)
                test2 = 1
            finally:
                if test2 == 0:
                    print("called pdf method", pdf_method)
                    print("with args", tmp)

            assert (isfloat(p))

        tmp = args + (10, )
        da = method(*tmp)

        array_check(da, arraytype, (10, ))
        if pdf_method:

            tmp = (da, ) + args
            pa = pdf_method(*tmp)
            array_check(pa, Float, (10, ))
Esempio n. 3
0
 def _test_nd_return_one(self, method, pdf_method, n, *args):
     test = 0
     try:
         d = method(*args)
         assert len(d) == n
         for i in d:
             assert isfloat(i)
         if pdf_method:
             p = apply(pdf_method, tuple(d) + args)
             assert isfloat(p)
         da = apply(method, args + (10,))
         array_check(da, Float, (10, n))
         if pdf_method:
             x = da[:, 0]
             y = da[:, 1]
             pa = apply(pdf_method, (x, y) + args)
             array_check(da, Float, (10, 2))
         test = 1
     finally:
         if test == 0:
             print "I was testing ", method, "with args", args
Esempio n. 4
0
 def _test_nd_return_one(self, method, pdf_method, n, *args):
     test = 0
     try:
         d = method(*args)
         assert (len(d) == n)
         for i in d:
             assert (isfloat(i))
         if pdf_method:
             p = pdf_method(*(tuple(d) + args))
             assert (isfloat(p))
         da = method(*(args + (10, )))
         array_check(da, Float, (10, n))
         if pdf_method:
             x = da[:, 0]
             y = da[:, 1]
             pa = pdf_method(*((x, y) + args))
             array_check(da, Float, (10, 2))
         test = 1
     finally:
         if test == 0:
             print("I was testing ", method, "with args", args)