Ejemplo n.º 1
0
def test_sa_delitem0():
    sa = Sparsearray([1, 2, 0, 0, 0, 0, 3, 0, 0, 4])
    del sa[1]
    assert sa.__repr__() == "Sparsearray([1, 0, 0, 0, 0, 0, 3, 0, 0, 4])"
Ejemplo n.º 2
0
def test_sa_len():
    sa = Sparsearray([1, 2, 0, 0, 0, 0, 3, 0, 0, 4])
    assert len(sa) == 10
Ejemplo n.º 3
0
def test_sa_getitem3():
    sa = Sparsearray([1, 2, 0, 0, 0, 0, 3, 0, 0, 4])
    assert sa[9] == 4
Ejemplo n.º 4
0
def test_sa_getitem0():
    sa = Sparsearray([1, 2, 0, 0, 0, 0, 3, 0, 0, 4])
    assert sa[13] == None
Ejemplo n.º 5
0
def test_sa_creation():
    sa = Sparsearray([1, 2, 0, 0, 0, 0, 3, 0, 0, 4])
    assert sa.__repr__() == "Sparsearray([1, 2, 0, 0, 0, 0, 3, 0, 0, 4])"
Ejemplo n.º 6
0
def test_sa_setitem2():
    sa = Sparsearray([1, 2, 0, 0, 0, 0, 3, 0, 0, 4])
    sa[0] = 0
    assert sa.__repr__() == "Sparsearray([0, 2, 0, 0, 0, 0, 3, 0, 0, 4])"
Ejemplo n.º 7
0
def test_sa_setitem0():
    sa = Sparsearray([1, 2, 0, 0, 0, 0, 3, 0, 0, 4])
    sa[5] = 12
    assert sa.__repr__() == "Sparsearray([1, 2, 0, 0, 0, 12, 3, 0, 0, 4])"