Exemple #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"))
Exemple #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')
Exemple #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'))
Exemple #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')
Exemple #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')])
Exemple #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')])
Exemple #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'))