Beispiel #1
0
def lix_setitem_test_09():
    def lixit(lar, index, value):
        lar.lix[index] = value
    actual = la.lrange(label=[['a', 'b'], ['c', 'd']])
    index = ['a']
    value = la.larry([10, 9], [['d', 'c']])
    assert_raises(IndexError, lixit, actual, index, value)
Beispiel #2
0
 def test_io_lara_1(self):
     "lara indexing bug #40"
     io = IO(self.filename)
     io['a'] = la.lrange(3)
     b = io['a']
     # b[[0, 2]] raised:
     # AttributeError: 'Dataset' object has no attribute 'take'
     b[[0, 2]]
Beispiel #3
0
def lix_setitem_test_09():
    def lixit(lar, index, value):
        lar.lix[index] = value

    actual = la.lrange(label=[['a', 'b'], ['c', 'd']])
    index = ['a']
    value = la.larry([10, 9], [['d', 'c']])
    assert_raises(IndexError, lixit, actual, index, value)
Beispiel #4
0
 def test_io_lara_1(self):
     "lara indexing bug #40"
     io = IO(self.filename)
     io['a'] = la.lrange(3)
     b = io['a']
     # b[[0, 2]] raised:
     # AttributeError: 'Dataset' object has no attribute 'take'
     b[[0,2]]
Beispiel #5
0
 def test_lrange_2(self):
     a = lrange(label=[['a', 'b', 'c', 'd']])
     d = larry([0, 1, 2, 3], [['a', 'b', 'c', 'd']])
     ale(a, d, "lrange failed.")
Beispiel #6
0
def larry_init_array_test():
    "larry.__init__array"
    desired = larry(np.array([[0, 1], [2, 3]]))
    actual = la.lrange((2, 2))
    ale(actual, desired, msg='create larry from matrix')
Beispiel #7
0
 def test_lrange_4(self):
     a = lrange(label=[['a', 'b'], ['c', 'd']])
     d = larry([[0, 1], [2, 3]], [['a', 'b'], ['c', 'd']])
     ale(a, d, "lrange failed.")
Beispiel #8
0
 def test_lrange_2(self):
     a = lrange(label=[['a', 'b', 'c', 'd']])
     d = larry([0, 1, 2, 3], [['a', 'b', 'c', 'd']])
     ale(a, d, "lrange failed.")
Beispiel #9
0
def lix_setitem_test_07():
    actual = la.lrange(label=[['a', 'b', 'c'], ['1', '2', '3']])
    actual.lix[['a', 'b'], ['1', '2']] = np.arange(4).reshape(2, 2)
    desired = la.lrange(label=[['a', 'b', 'c'], ['1', '2', '3']])
    desired[:2, :2] = np.arange(4).reshape(2, 2)
    ale(actual, desired)
Beispiel #10
0
def lix_setitem_test_01():
    actual = la.lrange(label=[['a', 'b']])
    actual.lix[['a']] = 9
    desired = la.lrange(label=[['a', 'b']])
    desired[0] = 9
    ale(actual, desired)
Beispiel #11
0
def larry_init_list_test():
    "larry.__init__list"
    desired = larry([[0, 1], [2, 3]])
    actual = la.lrange((2, 2))
    ale(actual, desired, msg='create larry from list')
Beispiel #12
0
def larry_init_array_test():
    "larry.__init__array"
    desired = larry(np.array([[0, 1], [2, 3]]))
    actual = la.lrange((2, 2))
    ale(actual, desired, msg='create larry from matrix')
Beispiel #13
0
def larry_init_tuple_test():
    "larry.__init__tuple"
    desired = larry(((0, 1), (2, 3)))
    actual = la.lrange((2, 2))
    ale(actual, desired, msg='create larry from tuple')
Beispiel #14
0
 def test_lrange_4(self):
     a = lrange(label=[['a', 'b'], ['c', 'd']])
     d = larry([[0, 1], [2, 3]], [['a', 'b'], ['c', 'd']])
     ale(a, d, "lrange failed.")
Beispiel #15
0
 def test_lrange_3(self):
     a = lrange((2, 2), dtype='f8')
     d = larry(np.array([0, 1, 2, 3], dtype='f8').reshape(2, 2))
     ale(a, d, "lrange failed.")
Beispiel #16
0
def lix_setitem_test_05():
    actual = la.lrange(label=[['a', 'b'], ['c', 'd']])
    actual.lix[['b'], ['d']] = 9
    desired = la.lrange(label=[['a', 'b'], ['c', 'd']])
    desired[1, 1] = 9
    ale(actual, desired)
Beispiel #17
0
def lix_setitem_test_06():
    actual = la.lrange(label=[['a', 'b', 'c'], ['1', '2', '3']])
    actual.lix[['a', 'b'], ['1', '2']] = 9
    desired = la.lrange(label=[['a', 'b', 'c'], ['1', '2', '3']])
    desired[:2, :2] = 9
    ale(actual, desired)
Beispiel #18
0
def lix_setitem_test_05():
    actual = la.lrange(label=[['a', 'b'], ['c', 'd']])
    actual.lix[['b'], ['d']] = 9
    desired = la.lrange(label=[['a', 'b'], ['c', 'd']])
    desired[1, 1] = 9
    ale(actual, desired)
Beispiel #19
0
def lix_setitem_test_08():
    actual = la.lrange(label=[['a', 'b'], ['c', 'd']])
    actual.lix[['a']] = la.larry([9, 10], [['c', 'd']])
    desired = la.lrange(label=[['a', 'b'], ['c', 'd']])
    desired[0] = [9, 10]
    ale(actual, desired)
Beispiel #20
0
def lix_setitem_test_06():
    actual = la.lrange(label=[['a', 'b', 'c'], ['1', '2', '3']])
    actual.lix[['a', 'b'], ['1', '2']] = 9
    desired = la.lrange(label=[['a', 'b', 'c'], ['1', '2', '3']])
    desired[:2, :2] = 9
    ale(actual, desired)
Beispiel #21
0
def lix_setitem_test_10():
    actual = la.lrange(label=[['a', 'b'], ['c', 'd']])
    actual.lix[:, ['d']] = la.larry([[9], [10]], [['a', 'b'], ['d']])
    desired = la.lrange(label=[['a', 'b'], ['c', 'd']])
    desired[:, -1] = [9, 10]
    ale(actual, desired)
Beispiel #22
0
def lix_setitem_test_07():
    actual = la.lrange(label=[['a', 'b', 'c'], ['1', '2', '3']])
    actual.lix[['a', 'b'], ['1', '2']] = np.arange(4).reshape(2, 2)
    desired = la.lrange(label=[['a', 'b', 'c'], ['1', '2', '3']])
    desired[:2, :2] = np.arange(4).reshape(2, 2)
    ale(actual, desired)
Beispiel #23
0
 def test_lrange_1(self):
     a = lrange(5)
     d = larry([0, 1, 2, 3, 4])
     ale(a, d, "lrange failed.")
Beispiel #24
0
def lix_setitem_test_08():
    actual = la.lrange(label=[['a', 'b'], ['c', 'd']])
    actual.lix[['a']] = la.larry([9, 10], [['c', 'd']])
    desired = la.lrange(label=[['a', 'b'], ['c', 'd']])
    desired[0] = [9, 10]
    ale(actual, desired)
Beispiel #25
0
 def test_lrange_3(self):
     a = lrange((2, 2), dtype='f8')
     d = larry(np.array([0, 1, 2, 3], dtype='f8').reshape(2,2))
     ale(a, d, "lrange failed.")
Beispiel #26
0
def lix_setitem_test_10():
    actual = la.lrange(label=[['a', 'b'], ['c', 'd']])
    actual.lix[:,['d']] = la.larry([[9], [10]], [['a', 'b'],['d']])
    desired = la.lrange(label=[['a', 'b'], ['c', 'd']])
    desired[:,-1] = [9, 10]
    ale(actual, desired)
Beispiel #27
0
def larry_init_tuple_test():
    "larry.__init__tuple"
    desired = larry(((0, 1), (2, 3)))
    actual = la.lrange((2, 2))
    ale(actual, desired, msg='create larry from tuple')
Beispiel #28
0
def lix_setitem_test_01():
    actual = la.lrange(label=[['a', 'b']])
    actual.lix[['a']] = 9
    desired = la.lrange(label=[['a', 'b']])
    desired[0] = 9
    ale(actual, desired)
Beispiel #29
0
def larry_init_list_test():
    "larry.__init__list"
    desired = larry([[0, 1], [2, 3]])
    actual = la.lrange((2, 2))
    ale(actual, desired, msg='create larry from list')
Beispiel #30
0
 def test_lrange_1(self):
     a = lrange(5)
     d = larry([0, 1, 2, 3, 4])
     ale(a, d, "lrange failed.")