Ejemplo n.º 1
0
    def test_strictjoin3(self):
        X = self.X
        keycols = self.keycols
        others=self.others
        X1 = X[:(3 * len(X) / 4)][keycols + others[0]]
        X2 = X[(len(X) / 4):][keycols + others[1]]
        Y = spreadsheet.strictjoin([X1, X2], self.keycols)
        Y.sort(order=keycols)

        nvf = utils.DEFAULT_NULLVALUEFORMAT
        nvf1 = nvf(X[others[1][0]].dtype.descr[0][1])
        nvf2 = nvf(X[others[1][1]].dtype.descr[0][1])
        nvf3 = nvf(X[others[0][0]].dtype.descr[0][1])
        nvf4 = nvf(X[others[0][1]].dtype.descr[0][1])

        Recs = ([(a, b, c, d, nvf1, nvf2) for (a, b, c, d, e, f) 
                                         in X[:(len(X) / 4)]] + 
                [(a, b, c, d, e, f) for (a, b, c, d, e, f) 
                                   in X[(len(X) / 4):(3 * len(X) / 4)]] + 
                [(a, b, nvf3, nvf4, e, f) for (a, b, c, d, e, f) 
                                         in X[(3 * len(X) / 4):]])
        Z = tb.tabarray(records=Recs, names=X.dtype.names)
        Z.sort(order=self.keycols)

        self.assert_((Y == Z).all())
Ejemplo n.º 2
0
 def test_strictjoin(self):
     ToMerge = [self.X[self.keycols + n] for n in self.others]
     Y = spreadsheet.strictjoin(ToMerge,self.keycols)
     Z = self.X.copy()
     Z.sort(order  = self.keycols)
     Y.sort(order = self.keycols)
     self.assert_((Z == Y).all())
Ejemplo n.º 3
0
 def test_strictjoin4(self):
     ToMerge = dict([('d' + str(i) , self.X[self.keycols + n]) 
                     for (i, n) in enumerate(self.others)])
     Y = spreadsheet.strictjoin(ToMerge, self.keycols)
     Y.sort(order=self.keycols)
     Z = self.X.copy()
     Z.sort(order=self.keycols)
     self.assert_((Z == Y).all())
Ejemplo n.º 4
0
 def test_strictjoin2(self):
     ToMerge = [self.X[self.keycols + [x]] for x in self.X.dtype.names 
                if x not in self.keycols]
     Y = spreadsheet.strictjoin(ToMerge, self.keycols)
     Z = self.X.copy()
     Z.sort(order=self.keycols)
     Y.sort(order=self.keycols)
     self.assert_((Z == Y).all())