Esempio n. 1
0
    def test_best_match(self):
        d1 = dshape('10, T1, int32')
        d2 = dshape('T2, T2, float32')
        match = best_match(f, [d1, d2])
        self.assertEqual(str(match.sig),
                         'X, Y, float32 -> X, Y, float32 -> X, Y, float32')

        input = dshape('1, 1, float32 -> 1, 1, float32 -> R')
        self.assertEqual(str(unify_simple(input, match.resolved_sig)),
                         '10, 1, float32 -> 10, 1, float32 -> 10, 1, float32')
Esempio n. 2
0
 def test_unification_typevar(self):
     tvar = Complex(T.TypeVar('A'))
     self.assertEqual(unify_simple(t1, tvar), t1)
Esempio n. 3
0
 def test_unification_concrete(self):
     self.assertEqual(unify_simple(t1, t2), t1)
 def test_unify_datashape_scalar(self):
     d1 = dshape('1, T1, int32')
     d2 = dshape('float64')
     result = unify_simple(d1, d2)
     self.assertEqual(result, dshape('1, 1, float64'))