Ejemplo n.º 1
0
 def test_cat_dshapes(self):
     # concatenating 1 dshape is a no-op
     dslist = [dshape("3 * 10 * int32")]
     self.assertEqual(datashape.cat_dshapes(dslist), dslist[0])
     # two dshapes
     dslist = [dshape("3 * 10 * int32"), dshape("7 * 10 * int32")]
     self.assertEqual(datashape.cat_dshapes(dslist), dshape("10 * 10 * int32"))
Ejemplo n.º 2
0
def test_cat_dshapes():
    # concatenating 1 dshape is a no-op
    dslist = [dshape('3 * 10 * int32')]
    assert datashape.cat_dshapes(dslist) == dslist[0]
    # two dshapes
    dslist = [dshape('3 * 10 * int32'), dshape('7 * 10 * int32')]
    assert datashape.cat_dshapes(dslist) == dshape('10 * 10 * int32')
Ejemplo n.º 3
0
 def test_cat_dshapes(self):
     # concatenating 1 dshape is a no-op
     dslist = [dshape('3 * 10 * int32')]
     self.assertEqual(datashape.cat_dshapes(dslist), dslist[0])
     # two dshapes
     dslist = [dshape('3 * 10 * int32'), dshape('7 * 10 * int32')]
     self.assertEqual(datashape.cat_dshapes(dslist),
                      dshape('10 * 10 * int32'))
Ejemplo n.º 4
0
def test_cat_dshapes():
    # concatenating 1 dshape is a no-op
    dslist = [dshape('3 * 10 * int32')]
    assert datashape.cat_dshapes(dslist) == dslist[0]
    # two dshapes
    dslist = [dshape('3 * 10 * int32'),
              dshape('7 * 10 * int32')]
    assert datashape.cat_dshapes(dslist) == dshape('10 * 10 * int32')
Ejemplo n.º 5
0
def test_cat_dshapes_errors():
    # need at least one dshape
    with pytest.raises(ValueError):
        datashape.cat_dshapes([])

    # dshapes need to match after the first dimension
    with pytest.raises(ValueError):
        datashape.cat_dshapes([dshape('3 * 10 * int32'),
                              dshape('3 * 1 * int32')])
Ejemplo n.º 6
0
def test_cat_dshapes_errors():
    # need at least one dshape
    with pytest.raises(ValueError):
        datashape.cat_dshapes([])

    # dshapes need to match after the first dimension
    with pytest.raises(ValueError):
        datashape.cat_dshapes(
            [dshape('3 * 10 * int32'),
             dshape('3 * 1 * int32')])
Ejemplo n.º 7
0
 def test_cat_dshapes(self):
     # concatenating 1 dshape is a no-op
     dslist = [dshape('3, 10, int32')]
     self.assertEqual(datashape.cat_dshapes(dslist),
                     dslist[0])
     # two dshapes
     dslist = [dshape('3, 10, int32'),
                     dshape('7, 10, int32')]
     self.assertEqual(datashape.cat_dshapes(dslist),
                     dshape('10, 10, int32'))