Exemplo n.º 1
0
def test_unitsum_tuples2():
    s = np.asarray(list(unitsum_tuples(4, 3, -1, 3)))
    s_ = np.asarray([
        (-1.0, -1.0, 3.0),
        (-1.0, 0.0, 2.0),
        (-1.0, 1.0, 1.0),
        (-1.0, 2.0, 0.0),
        (-1.0, 3.0, -1.0),
        (0.0, -1.0, 2.0),
        (0.0, 0.0, 1.0),
        (0.0, 1.0, 0.0),
        (0.0, 2.0, -1.0),
        (1.0, -1.0, 1.0),
        (1.0, 0.0, 0.0),
        (1.0, 1.0, -1.0),
        (2.0, -1.0, 0.0),
        (2.0, 0.0, -1.0),
        (3.0, -1.0, -1.0),
    ])
    assert np.allclose(s, s_)
Exemplo n.º 2
0
def test_unitsum_tuples2():
    s = np.asarray(list(unitsum_tuples(4, 3, -1, 3)))
    s_ = np.asarray([
        (-1.0, -1.0, 3.0),
        (-1.0, 0.0, 2.0),
        (-1.0, 1.0, 1.0),
        (-1.0, 2.0, 0.0),
        (-1.0, 3.0, -1.0),
        (0.0, -1.0, 2.0),
        (0.0, 0.0, 1.0),
        (0.0, 1.0, 0.0),
        (0.0, 2.0, -1.0),
        (1.0, -1.0, 1.0),
        (1.0, 0.0, 0.0),
        (1.0, 1.0, -1.0),
        (2.0, -1.0, 0.0),
        (2.0, 0.0, -1.0),
        (3.0, -1.0, -1.0),
    ])
    assert np.allclose(s, s_)
Exemplo n.º 3
0
def test_unitsum_tuples3():
    # Violate: 1 = mx + (k-1) * mn
    g = unitsum_tuples(3, 3, 1, 0)
    with pytest.raises(Exception):
        next(g)
Exemplo n.º 4
0
def test_unitsum_tuples1():
    s = np.asarray(list(unitsum_tuples(3, 2, .2, .8)))
    s_ = np.asarray([[.2, .8], [.4, .6], [.6, .4], [.8, .2]])
    assert np.allclose(s, s_)
Exemplo n.º 5
0
def test_unitsum_tuples3():
     # Violate: 1 = mx + (k-1) * mn
     g = unitsum_tuples(3, 3, 1, 0)
     with pytest.raises(Exception):
         next(g)
Exemplo n.º 6
0
def test_unitsum_tuples1():
    s = np.asarray(list(unitsum_tuples(3, 2, .2, .8)))
    s_ = np.asarray([[.2, .8], [.4, .6], [.6, .4], [.8, .2]])
    assert np.allclose(s, s_)
Exemplo n.º 7
0
def test_unitsum_tuples3():
    # Violate: 1 = mx + (k-1) * mn
    g = unitsum_tuples(3, 3, 1, 0)
    assert_raises(Exception, next, g)
Exemplo n.º 8
0
def test_unitsum_tuples3():
     # Violate: 1 = mx + (k-1) * mn
     g = unitsum_tuples(3, 3, 1, 0)
     assert_raises(Exception, next, g)