예제 #1
0
    def test_join_union_empty(self):
        # test if both inputs ar enull
        data = operators.join_union([operators.null, operators.null])
        for x in data:
            # they should have the same size as null, which is empty
            self.assertEquals(x.size, operators.null.size)

        # test if one of the inputs is null
        self.data[1] = operators.null
        data = operators.join_union(self.data)
        self.assertEquals(np.sum(data[0] - self.data[0]), 0)

        # the other stream should have copied timestamps from array 1
        self.assertEquals(np.sum(data[1][:, 0] - self.data[0][:, 0]), 0)
        # but only NaN's
        self.assertEquals(np.sum(np.isnan(data[1][:, 1])), len(data[1][:, 1]))
예제 #2
0
파일: test_group.py 프로젝트: ahaas/smap
    def test_join_union_empty(self):
        # test if both inputs ar enull
        data = operators.join_union([operators.null, operators.null])
        for x in data:
            # they should have the same size as null, which is empty
            self.assertEquals(x.size, operators.null.size)
        
        # test if one of the inputs is null
        self.data[1] = operators.null
        data = operators.join_union(self.data)
        self.assertEquals(np.sum(data[0] - self.data[0]), 0)

        # the other stream should have copied timestamps from array 1
        self.assertEquals(np.sum(data[1][:, 0] - self.data[0][:, 0]), 0)
        # but only NaN's
        self.assertEquals(np.sum(np.isnan(data[1][:, 1])), len(data[1][:, 1]))
예제 #3
0
 def test_join_union(self):
     data = operators.join_union(self.data)
     for x in data:
         self.assertEquals(len(x), 30)
         for i in xrange(0, len(x)):
             # make sure the timestamps came out right
             if i < 20:
                 self.assertEquals(x[i, 0], i)
             else:
                 self.assertEquals(x[i, 0], (i - 10) * 2)
예제 #4
0
파일: test_group.py 프로젝트: ahaas/smap
 def test_join_union(self):
     data = operators.join_union(self.data)
     for x in data:
         self.assertEquals(len(x), 30)
         for i in xrange(0, len(x)):
             # make sure the timestamps came out right
             if i < 20:
                 self.assertEquals(x[i, 0], i)
             else:
                 self.assertEquals(x[i, 0], (i - 10) * 2)